diff --git a/data/fonts/Times9k.bdf b/data/fonts/Times9k.bdf
deleted file mode 100644
index f1a67cd..0000000
--- a/data/fonts/Times9k.bdf
+++ /dev/null
@@ -1,3240 +0,0 @@
-STARTFONT 2.1
-COMMENT
-COMMENT Copyright (c) 2022, Sammy L. Koch (sammykoch2004@gmail.com),
-COMMENT with Reserved Font Name: "Times9k". Version 1.1.
-COMMENT
-COMMENT This Font Software is licensed under the SIL Open Font License, Version 1.1.
-FONT Times9k
-SIZE 7 72 72
-FONTBOUNDINGBOX 5 9 0 -2
-STARTPROPERTIES 11
-FOUNDRY "Fine"
-FAMILY_NAME "Times9k"
-WEIGHT_NAME "Book"
-SLANT "R"
-SETWIDTH_NAME "Book"
-SPACING "c"
-CHARSET_REGISTRY "ISO-8859"
-CHARSET_ENCODING "1"
-COPYRIGHT "Copyright (c) 2022, Sammy L. Koch"
-FONT_ASCENT 7
-FONT_DESCENT 2
-ENDPROPERTIES
-CHARS 256
-STARTCHAR C000
-ENCODING 0
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C001
-ENCODING 1
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 1 0
-BITMAP
-a0
-a0
-00
-e0
-40
-ENDCHAR
-STARTCHAR C002
-ENCODING 2
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-a8
-a8
-f8
-88
-d8
-f8
-f8
-ENDCHAR
-STARTCHAR C003
-ENCODING 3
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 1 0
-BITMAP
-a0
-e0
-e0
-e0
-40
-ENDCHAR
-STARTCHAR C004
-ENCODING 4
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 1
-BITMAP
-60
-f0
-f0
-60
-ENDCHAR
-STARTCHAR C005
-ENCODING 5
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-f0
-60
-f0
-f0
-60
-f0
-ENDCHAR
-STARTCHAR C006
-ENCODING 6
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-60
-f0
-f0
-60
-f0
-ENDCHAR
-STARTCHAR C007
-ENCODING 7
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 2 1 2
-BITMAP
-c0
-c0
-ENDCHAR
-STARTCHAR C010
-ENCODING 8
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-f8
-98
-98
-f8
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C011
-ENCODING 9
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C012
-ENCODING 10
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C013
-ENCODING 11
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-30
-20
-60
-90
-60
-ENDCHAR
-STARTCHAR C014
-ENCODING 12
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-60
-20
-70
-20
-ENDCHAR
-STARTCHAR C015
-ENCODING 13
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C016
-ENCODING 14
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-50
-70
-40
-c0
-c0
-ENDCHAR
-STARTCHAR C017
-ENCODING 15
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-50
-70
-50
-d0
-d0
-ENDCHAR
-STARTCHAR C020
-ENCODING 16
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-80
-c0
-e0
-f0
-e0
-c0
-80
-ENDCHAR
-STARTCHAR C021
-ENCODING 17
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-10
-30
-70
-f0
-70
-30
-10
-ENDCHAR
-STARTCHAR C022
-ENCODING 18
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 0 1
-BITMAP
-40
-e0
-40
-e0
-40
-ENDCHAR
-STARTCHAR C023
-ENCODING 19
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-a0
-a0
-a0
-a0
-00
-a0
-ENDCHAR
-STARTCHAR C024
-ENCODING 20
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 -1
-BITMAP
-f0
-d0
-d0
-d0
-50
-50
-50
-ENDCHAR
-STARTCHAR C025
-ENCODING 21
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-c0
-a0
-50
-30
-e0
-ENDCHAR
-STARTCHAR C026
-ENCODING 22
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 2 0 0
-BITMAP
-f0
-f0
-ENDCHAR
-STARTCHAR C027
-ENCODING 23
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-40
-e0
-40
-e0
-40
-e0
-ENDCHAR
-STARTCHAR C030
-ENCODING 24
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 1 1
-BITMAP
-40
-e0
-40
-40
-40
-ENDCHAR
-STARTCHAR C031
-ENCODING 25
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 1 1
-BITMAP
-40
-40
-40
-e0
-40
-ENDCHAR
-STARTCHAR C032
-ENCODING 26
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-20
-f0
-20
-ENDCHAR
-STARTCHAR C033
-ENCODING 27
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-40
-f0
-40
-ENDCHAR
-STARTCHAR C034
-ENCODING 28
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 2 0 0
-BITMAP
-80
-f0
-ENDCHAR
-STARTCHAR C035
-ENCODING 29
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-50
-f0
-50
-ENDCHAR
-STARTCHAR C036
-ENCODING 30
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-60
-60
-f0
-f0
-f0
-ENDCHAR
-STARTCHAR C037
-ENCODING 31
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-f0
-f0
-60
-60
-60
-ENDCHAR
-STARTCHAR C040
-ENCODING 32
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C041
-ENCODING 33
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 1 0
-BITMAP
-c0
-c0
-c0
-c0
-00
-c0
-ENDCHAR
-STARTCHAR C042
-ENCODING 34
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 3
-BITMAP
-50
-50
-a0
-ENDCHAR
-STARTCHAR C043
-ENCODING 35
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-50
-f0
-50
-50
-f0
-50
-ENDCHAR
-STARTCHAR C044
-ENCODING 36
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 8 0 -1
-BITMAP
-20
-70
-a0
-60
-20
-30
-e0
-20
-ENDCHAR
-STARTCHAR C045
-ENCODING 37
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-90
-30
-60
-c0
-90
-ENDCHAR
-STARTCHAR C046
-ENCODING 38
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-50
-20
-60
-b0
-90
-60
-ENDCHAR
-STARTCHAR C047
-ENCODING 39
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 1 3
-BITMAP
-40
-40
-80
-ENDCHAR
-STARTCHAR C050
-ENCODING 40
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 2 0
-BITMAP
-40
-80
-80
-80
-80
-40
-ENDCHAR
-STARTCHAR C051
-ENCODING 41
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 0 0
-BITMAP
-80
-40
-40
-40
-40
-80
-ENDCHAR
-STARTCHAR C052
-ENCODING 42
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 3 1 3
-BITMAP
-a0
-40
-a0
-ENDCHAR
-STARTCHAR C053
-ENCODING 43
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 3 1 2
-BITMAP
-40
-e0
-40
-ENDCHAR
-STARTCHAR C054
-ENCODING 44
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 1 -1
-BITMAP
-c0
-c0
-80
-ENDCHAR
-STARTCHAR C055
-ENCODING 45
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 1 1 3
-BITMAP
-e0
-ENDCHAR
-STARTCHAR C056
-ENCODING 46
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 2 1 0
-BITMAP
-c0
-c0
-ENDCHAR
-STARTCHAR C057
-ENCODING 47
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-10
-10
-20
-40
-80
-80
-ENDCHAR
-STARTCHAR C060
-ENCODING 48
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-b0
-d0
-90
-60
-ENDCHAR
-STARTCHAR C061
-ENCODING 49
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-40
-c0
-40
-40
-40
-e0
-ENDCHAR
-STARTCHAR C062
-ENCODING 50
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-20
-40
-80
-f0
-ENDCHAR
-STARTCHAR C063
-ENCODING 51
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-20
-10
-90
-60
-ENDCHAR
-STARTCHAR C064
-ENCODING 52
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-60
-a0
-a0
-f0
-20
-ENDCHAR
-STARTCHAR C065
-ENCODING 53
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-80
-e0
-10
-90
-60
-ENDCHAR
-STARTCHAR C066
-ENCODING 54
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-80
-e0
-90
-90
-60
-ENDCHAR
-STARTCHAR C067
-ENCODING 55
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-10
-20
-40
-40
-40
-ENDCHAR
-STARTCHAR C070
-ENCODING 56
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C071
-ENCODING 57
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-90
-70
-10
-60
-ENDCHAR
-STARTCHAR C072
-ENCODING 58
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 5 1 0
-BITMAP
-c0
-c0
-00
-c0
-c0
-ENDCHAR
-STARTCHAR C073
-ENCODING 59
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 0 -1
-BITMAP
-60
-00
-60
-60
-c0
-ENDCHAR
-STARTCHAR C074
-ENCODING 60
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-30
-60
-c0
-60
-30
-ENDCHAR
-STARTCHAR C075
-ENCODING 61
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-f0
-00
-f0
-ENDCHAR
-STARTCHAR C076
-ENCODING 62
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-c0
-60
-30
-60
-c0
-ENDCHAR
-STARTCHAR C077
-ENCODING 63
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-10
-60
-00
-40
-ENDCHAR
-STARTCHAR C100
-ENCODING 64
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-b0
-b0
-80
-60
-ENDCHAR
-STARTCHAR C101
-ENCODING 65
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-f0
-90
-90
-90
-ENDCHAR
-STARTCHAR C102
-ENCODING 66
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-e0
-90
-e0
-90
-90
-e0
-ENDCHAR
-STARTCHAR C103
-ENCODING 67
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-80
-80
-90
-60
-ENDCHAR
-STARTCHAR C104
-ENCODING 68
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-e0
-90
-90
-90
-90
-e0
-ENDCHAR
-STARTCHAR C105
-ENCODING 69
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-80
-e0
-80
-80
-f0
-ENDCHAR
-STARTCHAR C106
-ENCODING 70
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-80
-e0
-80
-80
-80
-ENDCHAR
-STARTCHAR C107
-ENCODING 71
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-80
-b0
-90
-90
-60
-ENDCHAR
-STARTCHAR C110
-ENCODING 72
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-f0
-90
-90
-90
-ENDCHAR
-STARTCHAR C111
-ENCODING 73
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-e0
-40
-40
-40
-40
-e0
-ENDCHAR
-STARTCHAR C112
-ENCODING 74
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-30
-10
-10
-10
-90
-60
-ENDCHAR
-STARTCHAR C113
-ENCODING 75
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-e0
-90
-90
-90
-ENDCHAR
-STARTCHAR C114
-ENCODING 76
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-80
-80
-80
-80
-f0
-ENDCHAR
-STARTCHAR C115
-ENCODING 77
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-f0
-f0
-90
-90
-90
-ENDCHAR
-STARTCHAR C116
-ENCODING 78
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-d0
-f0
-f0
-b0
-90
-ENDCHAR
-STARTCHAR C117
-ENCODING 79
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C120
-ENCODING 80
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-e0
-90
-e0
-80
-80
-80
-ENDCHAR
-STARTCHAR C121
-ENCODING 81
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 -1
-BITMAP
-60
-90
-90
-90
-b0
-60
-10
-ENDCHAR
-STARTCHAR C122
-ENCODING 82
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-e0
-90
-e0
-90
-90
-90
-ENDCHAR
-STARTCHAR C123
-ENCODING 83
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-40
-20
-90
-60
-ENDCHAR
-STARTCHAR C124
-ENCODING 84
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-e0
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR C125
-ENCODING 85
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C126
-ENCODING 86
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-90
-f0
-60
-60
-ENDCHAR
-STARTCHAR C127
-ENCODING 87
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-90
-f0
-f0
-90
-ENDCHAR
-STARTCHAR C130
-ENCODING 88
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-60
-60
-90
-90
-ENDCHAR
-STARTCHAR C131
-ENCODING 89
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-90
-70
-10
-90
-60
-ENDCHAR
-STARTCHAR C132
-ENCODING 90
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-f0
-10
-20
-40
-80
-f0
-ENDCHAR
-STARTCHAR C133
-ENCODING 91
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 2 0
-BITMAP
-c0
-80
-80
-80
-80
-c0
-ENDCHAR
-STARTCHAR C134
-ENCODING 92
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-80
-40
-20
-10
-10
-ENDCHAR
-STARTCHAR C135
-ENCODING 93
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 0 0
-BITMAP
-c0
-40
-40
-40
-40
-c0
-ENDCHAR
-STARTCHAR C136
-ENCODING 94
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 2 1 4
-BITMAP
-40
-a0
-ENDCHAR
-STARTCHAR C137
-ENCODING 95
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 1 0 -1
-BITMAP
-f0
-ENDCHAR
-STARTCHAR C140
-ENCODING 96
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 1 3
-BITMAP
-80
-80
-40
-ENDCHAR
-STARTCHAR C141
-ENCODING 97
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C142
-ENCODING 98
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-80
-e0
-90
-90
-e0
-ENDCHAR
-STARTCHAR C143
-ENCODING 99
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 4 0 0
-BITMAP
-60
-80
-80
-60
-ENDCHAR
-STARTCHAR C144
-ENCODING 100
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-10
-10
-70
-90
-90
-70
-ENDCHAR
-STARTCHAR C145
-ENCODING 101
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-f0
-80
-60
-ENDCHAR
-STARTCHAR C146
-ENCODING 102
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-30
-40
-e0
-40
-40
-40
-ENDCHAR
-STARTCHAR C147
-ENCODING 103
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 -2
-BITMAP
-60
-90
-90
-70
-10
-e0
-ENDCHAR
-STARTCHAR C150
-ENCODING 104
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-80
-e0
-90
-90
-90
-ENDCHAR
-STARTCHAR C151
-ENCODING 105
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-40
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C152
-ENCODING 106
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 0 0
-BITMAP
-20
-00
-60
-20
-a0
-40
-ENDCHAR
-STARTCHAR C153
-ENCODING 107
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-80
-90
-e0
-a0
-90
-ENDCHAR
-STARTCHAR C154
-ENCODING 108
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-80
-80
-80
-80
-a0
-40
-ENDCHAR
-STARTCHAR C155
-ENCODING 109
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-f0
-f0
-90
-ENDCHAR
-STARTCHAR C156
-ENCODING 110
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-90
-90
-90
-ENDCHAR
-STARTCHAR C157
-ENCODING 111
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C160
-ENCODING 112
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 -2
-BITMAP
-60
-90
-90
-e0
-80
-80
-ENDCHAR
-STARTCHAR C161
-ENCODING 113
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 -2
-BITMAP
-60
-90
-90
-70
-10
-10
-ENDCHAR
-STARTCHAR C162
-ENCODING 114
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-b0
-c0
-80
-80
-ENDCHAR
-STARTCHAR C163
-ENCODING 115
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-70
-c0
-30
-e0
-ENDCHAR
-STARTCHAR C164
-ENCODING 116
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-40
-40
-e0
-40
-40
-20
-ENDCHAR
-STARTCHAR C165
-ENCODING 117
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C166
-ENCODING 118
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-90
-90
-60
-60
-ENDCHAR
-STARTCHAR C167
-ENCODING 119
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-90
-90
-f0
-f0
-ENDCHAR
-STARTCHAR C170
-ENCODING 120
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-90
-60
-60
-90
-ENDCHAR
-STARTCHAR C171
-ENCODING 121
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 -2
-BITMAP
-90
-90
-90
-70
-10
-e0
-ENDCHAR
-STARTCHAR C172
-ENCODING 122
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-f0
-30
-c0
-f0
-ENDCHAR
-STARTCHAR C173
-ENCODING 123
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-20
-40
-40
-80
-40
-40
-20
-ENDCHAR
-STARTCHAR C174
-ENCODING 124
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 1 7 2 0
-BITMAP
-80
-80
-80
-00
-80
-80
-80
-ENDCHAR
-STARTCHAR C175
-ENCODING 125
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-80
-40
-40
-20
-40
-40
-80
-ENDCHAR
-STARTCHAR C176
-ENCODING 126
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 2 0 3
-BITMAP
-50
-a0
-ENDCHAR
-STARTCHAR C177
-ENCODING 127
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-60
-88
-10
-60
-88
-10
-60
-88
-10
-ENDCHAR
-STARTCHAR C200
-ENCODING 128
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C201
-ENCODING 129
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 0 4
-BITMAP
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C202
-ENCODING 130
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 3 2 4
-BITMAP
-e0
-e0
-e0
-ENDCHAR
-STARTCHAR C203
-ENCODING 131
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 3 0 4
-BITMAP
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C204
-ENCODING 132
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 0 1
-BITMAP
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C205
-ENCODING 133
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 0 1
-BITMAP
-c0
-c0
-c0
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C206
-ENCODING 134
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-38
-38
-38
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C207
-ENCODING 135
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-f8
-f8
-f8
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C210
-ENCODING 136
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 3 2 1
-BITMAP
-e0
-e0
-e0
-ENDCHAR
-STARTCHAR C211
-ENCODING 137
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-c0
-c0
-c0
-38
-38
-38
-ENDCHAR
-STARTCHAR C212
-ENCODING 138
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 2 1
-BITMAP
-e0
-e0
-e0
-e0
-e0
-e0
-ENDCHAR
-STARTCHAR C213
-ENCODING 139
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-f8
-f8
-f8
-38
-38
-38
-ENDCHAR
-STARTCHAR C214
-ENCODING 140
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 3 0 1
-BITMAP
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C215
-ENCODING 141
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-c0
-c0
-c0
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C216
-ENCODING 142
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-38
-38
-38
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C217
-ENCODING 143
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 1
-BITMAP
-f8
-f8
-f8
-f8
-f8
-f8
-ENDCHAR
-STARTCHAR C220
-ENCODING 144
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 0 -2
-BITMAP
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C221
-ENCODING 145
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 9 0 -2
-BITMAP
-c0
-c0
-c0
-00
-00
-00
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C222
-ENCODING 146
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-38
-38
-38
-00
-00
-00
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C223
-ENCODING 147
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-f8
-00
-00
-00
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C224
-ENCODING 148
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 6 0 -2
-BITMAP
-c0
-c0
-c0
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C225
-ENCODING 149
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 9 0 -2
-BITMAP
-c0
-c0
-c0
-c0
-c0
-c0
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C226
-ENCODING 150
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-38
-38
-38
-c0
-c0
-c0
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C227
-ENCODING 151
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-f8
-c0
-c0
-c0
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C230
-ENCODING 152
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 -2
-BITMAP
-38
-38
-38
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C231
-ENCODING 153
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-c0
-c0
-c0
-38
-38
-38
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C232
-ENCODING 154
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-38
-38
-38
-38
-38
-38
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C233
-ENCODING 155
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-f8
-38
-38
-38
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C234
-ENCODING 156
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 6 0 -2
-BITMAP
-f8
-f8
-f8
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C235
-ENCODING 157
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-c0
-c0
-c0
-f8
-f8
-f8
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C236
-ENCODING 158
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-38
-38
-38
-f8
-f8
-f8
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C237
-ENCODING 159
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 5 9 0 -2
-BITMAP
-f8
-f8
-f8
-f8
-f8
-f8
-c0
-c0
-c0
-ENDCHAR
-STARTCHAR C240
-ENCODING 160
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 0 0 0 0
-BITMAP
-ENDCHAR
-STARTCHAR C241
-ENCODING 161
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-40
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C242
-ENCODING 162
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-20
-70
-80
-80
-70
-20
-ENDCHAR
-STARTCHAR C243
-ENCODING 163
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-20
-50
-40
-e0
-40
-f0
-ENDCHAR
-STARTCHAR C244
-ENCODING 164
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 9 0 -2
-BITMAP
-90
-90
-60
-90
-90
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C245
-ENCODING 165
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-a0
-a0
-40
-e0
-40
-e0
-40
-ENDCHAR
-STARTCHAR C246
-ENCODING 166
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 1 5 1 0
-BITMAP
-80
-80
-00
-80
-80
-ENDCHAR
-STARTCHAR C247
-ENCODING 167
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-c0
-a0
-50
-30
-e0
-ENDCHAR
-STARTCHAR C250
-ENCODING 168
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 1 0 5
-BITMAP
-a0
-ENDCHAR
-STARTCHAR C251
-ENCODING 169
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-60
-d0
-b0
-d0
-60
-ENDCHAR
-STARTCHAR C252
-ENCODING 170
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 1
-BITMAP
-60
-10
-70
-90
-90
-70
-ENDCHAR
-STARTCHAR C253
-ENCODING 171
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-50
-a0
-50
-ENDCHAR
-STARTCHAR C254
-ENCODING 172
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 2 0 1
-BITMAP
-f0
-10
-ENDCHAR
-STARTCHAR C255
-ENCODING 173
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 1 0 2
-BITMAP
-f0
-ENDCHAR
-STARTCHAR C256
-ENCODING 174
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-60
-d0
-b0
-b0
-60
-ENDCHAR
-STARTCHAR C257
-ENCODING 175
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 1 0 5
-BITMAP
-f0
-ENDCHAR
-STARTCHAR C260
-ENCODING 176
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 3 1 3
-BITMAP
-40
-a0
-40
-ENDCHAR
-STARTCHAR C261
-ENCODING 177
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 5 1 0
-BITMAP
-40
-e0
-40
-00
-e0
-ENDCHAR
-STARTCHAR C262
-ENCODING 178
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 4 1 3
-BITMAP
-80
-40
-80
-c0
-ENDCHAR
-STARTCHAR C263
-ENCODING 179
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 5 1 2
-BITMAP
-80
-40
-80
-40
-80
-ENDCHAR
-STARTCHAR C264
-ENCODING 180
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 1 3
-BITMAP
-40
-80
-80
-ENDCHAR
-STARTCHAR C265
-ENCODING 181
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 -2
-BITMAP
-90
-90
-90
-e0
-80
-80
-ENDCHAR
-STARTCHAR C266
-ENCODING 182
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 -1
-BITMAP
-f0
-d0
-d0
-d0
-50
-50
-50
-ENDCHAR
-STARTCHAR C267
-ENCODING 183
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 2 1 2
-BITMAP
-c0
-c0
-ENDCHAR
-STARTCHAR C270
-ENCODING 184
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 3 1 -1
-BITMAP
-c0
-40
-80
-ENDCHAR
-STARTCHAR C271
-ENCODING 185
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 2 4 1 3
-BITMAP
-40
-c0
-40
-40
-ENDCHAR
-STARTCHAR C272
-ENCODING 186
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 1
-BITMAP
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C273
-ENCODING 187
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 3 0 1
-BITMAP
-a0
-50
-a0
-ENDCHAR
-STARTCHAR C274
-ENCODING 188
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-90
-30
-60
-c0
-90
-ENDCHAR
-STARTCHAR C275
-ENCODING 189
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-90
-30
-60
-c0
-90
-ENDCHAR
-STARTCHAR C276
-ENCODING 190
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 0
-BITMAP
-90
-30
-60
-c0
-90
-ENDCHAR
-STARTCHAR C277
-ENCODING 191
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-40
-00
-60
-10
-90
-60
-ENDCHAR
-STARTCHAR C300
-ENCODING 192
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-c0
-00
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C301
-ENCODING 193
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-30
-00
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C302
-ENCODING 194
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-90
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C303
-ENCODING 195
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C304
-ENCODING 196
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-90
-00
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C305
-ENCODING 197
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-00
-60
-90
-f0
-90
-90
-ENDCHAR
-STARTCHAR C306
-ENCODING 198
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-a0
-f0
-a0
-a0
-b0
-ENDCHAR
-STARTCHAR C307
-ENCODING 199
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 8 0 -2
-BITMAP
-60
-90
-80
-80
-90
-60
-20
-40
-ENDCHAR
-STARTCHAR C310
-ENCODING 200
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-c0
-00
-f0
-80
-e0
-80
-f0
-ENDCHAR
-STARTCHAR C311
-ENCODING 201
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-30
-00
-f0
-80
-e0
-80
-f0
-ENDCHAR
-STARTCHAR C312
-ENCODING 202
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-f0
-80
-e0
-80
-f0
-ENDCHAR
-STARTCHAR C313
-ENCODING 203
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-90
-00
-f0
-80
-e0
-80
-f0
-ENDCHAR
-STARTCHAR C314
-ENCODING 204
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-80
-40
-00
-e0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C315
-ENCODING 205
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-20
-40
-00
-e0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C316
-ENCODING 206
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-40
-a0
-00
-e0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C317
-ENCODING 207
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-a0
-00
-e0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C320
-ENCODING 208
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-e0
-90
-d0
-90
-90
-e0
-ENDCHAR
-STARTCHAR C321
-ENCODING 209
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-90
-d0
-f0
-b0
-90
-ENDCHAR
-STARTCHAR C322
-ENCODING 210
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-60
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C323
-ENCODING 211
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-40
-60
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C324
-ENCODING 212
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-90
-60
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C325
-ENCODING 213
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-60
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C326
-ENCODING 214
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-90
-00
-60
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C327
-ENCODING 215
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 1
-BITMAP
-90
-60
-60
-90
-ENDCHAR
-STARTCHAR C330
-ENCODING 216
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-60
-90
-a0
-50
-90
-60
-ENDCHAR
-STARTCHAR C331
-ENCODING 217
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-80
-40
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C332
-ENCODING 218
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-10
-20
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C333
-ENCODING 219
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-00
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C334
-ENCODING 220
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-90
-00
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C335
-ENCODING 221
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-10
-20
-90
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C336
-ENCODING 222
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-e0
-90
-e0
-80
-80
-ENDCHAR
-STARTCHAR C337
-ENCODING 223
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 -1
-BITMAP
-60
-90
-a0
-90
-90
-a0
-80
-ENDCHAR
-STARTCHAR C340
-ENCODING 224
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-00
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C341
-ENCODING 225
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-40
-00
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C342
-ENCODING 226
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-50
-00
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C343
-ENCODING 227
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-00
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C344
-ENCODING 228
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-50
-00
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C345
-ENCODING 229
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-50
-20
-60
-10
-f0
-70
-ENDCHAR
-STARTCHAR C346
-ENCODING 230
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-70
-b0
-a0
-70
-ENDCHAR
-STARTCHAR C347
-ENCODING 231
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 0 -2
-BITMAP
-60
-80
-80
-60
-40
-80
-ENDCHAR
-STARTCHAR C350
-ENCODING 232
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-00
-60
-f0
-80
-60
-ENDCHAR
-STARTCHAR C351
-ENCODING 233
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-40
-00
-60
-f0
-80
-60
-ENDCHAR
-STARTCHAR C352
-ENCODING 234
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-50
-00
-60
-f0
-80
-60
-ENDCHAR
-STARTCHAR C353
-ENCODING 235
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-50
-00
-60
-f0
-80
-60
-ENDCHAR
-STARTCHAR C354
-ENCODING 236
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-80
-40
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C355
-ENCODING 237
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-20
-40
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C356
-ENCODING 238
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 7 1 0
-BITMAP
-40
-a0
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C357
-ENCODING 239
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 3 6 1 0
-BITMAP
-a0
-00
-c0
-40
-40
-e0
-ENDCHAR
-STARTCHAR C360
-ENCODING 240
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-10
-70
-90
-90
-60
-ENDCHAR
-STARTCHAR C361
-ENCODING 241
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-00
-60
-90
-90
-90
-ENDCHAR
-STARTCHAR C362
-ENCODING 242
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-00
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C363
-ENCODING 243
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-40
-00
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C364
-ENCODING 244
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-90
-00
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C365
-ENCODING 245
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-50
-a0
-00
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C366
-ENCODING 246
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-00
-60
-90
-90
-60
-ENDCHAR
-STARTCHAR C367
-ENCODING 247
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 5 0 1
-BITMAP
-40
-00
-f0
-00
-20
-ENDCHAR
-STARTCHAR C370
-ENCODING 248
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 4 0 0
-BITMAP
-60
-b0
-d0
-60
-ENDCHAR
-STARTCHAR C371
-ENCODING 249
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-40
-20
-00
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C372
-ENCODING 250
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-20
-40
-00
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C373
-ENCODING 251
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 7 0 0
-BITMAP
-60
-90
-00
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C374
-ENCODING 252
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-90
-00
-90
-90
-90
-60
-ENDCHAR
-STARTCHAR C375
-ENCODING 253
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 9 0 -2
-BITMAP
-20
-40
-00
-90
-90
-90
-70
-10
-e0
-ENDCHAR
-STARTCHAR C376
-ENCODING 254
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-80
-e0
-90
-90
-e0
-80
-ENDCHAR
-STARTCHAR C377
-ENCODING 255
-SWIDTH 714 0
-DWIDTH 5 0
-BBX 4 8 0 -2
-BITMAP
-90
-00
-90
-90
-90
-70
-10
-e0
-ENDCHAR
-ENDFONT
diff --git a/data/images/missing.bimg b/data/images/missing.bimg
deleted file mode 100644
index e788e91..0000000
--- a/data/images/missing.bimg
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- {
- {"","787","808"},
- {"
","080","808"},
- {"","708","887"}
- },
- version = "1.0.0",
- animation = false,
- title = "Missing bimg",
- description = "Oh oh, the source is missing!",
- author = "Kristify",
- creator = "Keyboard and Mouse",
- date = "2022-09-11T19:04:24+0000",
-}
-
diff --git a/data/images/script.bimg b/data/images/script.bimg
deleted file mode 100644
index 4e5467c..0000000
--- a/data/images/script.bimg
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- {
- {"ddd","7c7","208"},
- {"aaa","f32","403"},
- {"fff","733","867"}
- },
- version = "1.0.0",
- animation = false,
- title = "Missing bimg",
- description = "Oh oh, the source is missing!",
- author = "Kristify",
- creator = "Keyboard and Mouse",
- date = "2022-09-11T19:04:24+0000",
-}
-
diff --git a/data/pages/home.xml b/data/pages/home.xml
deleted file mode 100644
index ca6e09c..0000000
--- a/data/pages/home.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/data/pages/index.xml b/data/pages/index.xml
index dfd177e..23ddf46 100644
--- a/data/pages/index.xml
+++ b/data/pages/index.xml
@@ -1,7 +1,17 @@
-
-
- - Home
- - Products
-
- >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data/pages/products.xml b/data/pages/products.xml
deleted file mode 100644
index 9397551..0000000
--- a/data/pages/products.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/data/pages/theme.lua b/data/pages/theme.lua
index 116981d..a210b28 100644
--- a/data/pages/theme.lua
+++ b/data/pages/theme.lua
@@ -1,14 +1,3 @@
return {
- FrameBG = colors.black,
- MenubarBG = colors.cyan,
- MenubarText = colors.white,
- SelectionText = colors.white,
- SelectionBG = colors.black,
- ListBG = colors.gray,
- ListText = colors.black,
- LabelBG = colors.black,
- LabelText = colors.white,
- ScrollbarText = colors.black,
- ScrollbarBG = colors.gray,
- ScrollbarSymbolColor = colors.lightGray
+
}
\ No newline at end of file
diff --git a/data/pages/widget.xml b/data/pages/widget.xml
new file mode 100644
index 0000000..7eb18af
--- /dev/null
+++ b/data/pages/widget.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data/products.lua b/data/products.lua
index 1565da6..189ab26 100644
--- a/data/products.lua
+++ b/data/products.lua
@@ -2,16 +2,25 @@
{
displayName = "Dirt",
description = "Has good quality.",
- bimg = { { "", " ", "888" }, { "", "888", "ccc" }, { "", "c c", " c " } },
- price = 2,
- id = "minecraft:dirt",
- metaname = "dirt",
+ price = 999,
+ id = "minecraft:dirt"
},
{
displayName = "Diamond",
description = "Only for a limited time!",
price = 14,
- id = "minecraft:diamond",
- metaname = "dia",
+ id = "minecraft:diamond"
+ },
+ {
+ displayName = "Emerald",
+ description = "Peps with longe nose like those stuff..",
+ price = 2,
+ id = "minecraft:emerald"
+ },
+ {
+ displayName = "Paper",
+ description = "Maby you need it, i dunno.",
+ price = 1,
+ id = "minecraft:paper"
},
}
diff --git a/src/frontend.lua b/src/frontend.lua
new file mode 100644
index 0000000..b274eb0
--- /dev/null
+++ b/src/frontend.lua
@@ -0,0 +1,98 @@
+local ctx = ({...})[1]
+local basalt = require("libs/basalt")
+
+local function searchObject(base, id)
+ local obj = base:getObject(id)
+ if not obj then
+ local tAll = base:getLastLayout()
+ for _,obj in pairs(tAll) do
+ if obj and obj.getType and obj.getType() == "Frame" then
+ local found = searchObject(obj, id)
+ if found then
+ return found
+ end
+ end
+ end
+ end
+ return obj
+end
+
+-- Button functoins
+basalt.setVariable("openHelpDialog", function()
+ --basalt.debug("But nobody came.")
+ os.queueEvent("kstUpdateProducts")
+end)
+basalt.setVariable("selectNewCategory", function()
+ basalt.debug("")
+end)
+
+-- Create frame
+local base = basalt.createFrame()
+ :setTheme(ctx.theme)
+ :addLayout(fs.combine(ctx.path.page, "index.xml"))
+
+-- Events
+basalt.onEvent(function(event)
+ if event == "kstUpdateProducts" then
+ local body = searchObject(base, "_body")
+ -- Clear
+ repeat
+ local obj = body:getObject("_widget")
+ body:removeObject(obj)
+ until not obj
+ -- Sort
+ local tItems = {}
+ for _,item in ipairs(ctx.products) do
+ if --[[INSERT CHECK IF IT IS AVAILABLE]] true then
+ local newItem = {
+ amount = 1, -- INSERT AVAILABLE AMOUNT
+ }
+ for k,v in pairs(item) do
+ newItem[k] = v
+ end
+ tItems[#tItems+1] = newItem
+ end
+ end
+ table.sort(tItems, function(a,b)
+ return a.amount > b.amount
+ end)
+ -- Get size of widget
+ local dummy = body:addLayout(fs.combine(ctx.path.page, "widget.xml"))
+ dummy = dummy:getObject("_widget")
+ local nW,_ = body:getSize()
+ local nSubW,nSubH = dummy:getSize()
+ body:removeObject(dummy)
+ -- Insert
+ local spaceW = nW/nSubW-1
+ local nX,nY = 0,0
+ for i,item in ipairs(tItems) do
+ body:addLayout(fs.combine(ctx.path.page, "widget.xml"))
+ local widget = body:getObject("_widget")
+ :setPosition(nSubW*nX+1, nSubH*nY+1)
+ widget.name = "_widget_"..i
+
+ -- Adjust data
+ local name = searchObject(widget, "_name")
+ :setText(item.displayName)
+
+ local amount = searchObject(widget, "_onStock")
+ :setText(item.amount.."x")
+
+ local button = searchObject(widget, "_purchase")
+ local _,h = button:getSize()
+ local btnLabel = item.price.."kst"
+ button
+ :setText(btnLabel)
+ :setSize(#btnLabel+2,h)
+
+ -- Next grid space
+ nX = nX+1
+ if nX > spaceW then
+ nX = 0
+ nY = nY+1
+ end
+ end
+ end
+end)
+
+basalt.autoUpdate(base)
\ No newline at end of file
diff --git a/src/init.lua b/src/init.lua
index d990810..6d431ea 100644
--- a/src/init.lua
+++ b/src/init.lua
@@ -2,47 +2,16 @@
local sSrc = fs.getDir(shell.getRunningProgram())
local sRoot = fs.combine(sSrc, "..")
local sData = fs.combine(sRoot, "data")
-local sFont = fs.combine(sData, "fonts")
-local sImg = fs.combine(sData, "images")
local sPage = fs.combine(sData, "pages")
-local basalt = require("libs/basalt")
-local bdf = require("libs/basalt/libraries/miniBDF")
local ctx
-local function purchase(self, event, button, x, y)
- if event == "mouse_click" and button == 1 then
- local metadata = self:getMetadata()
- if metadata.id then
- -- TODO Open popup that tells user where to send krist to get item
- basalt.debug("Item: " .. ctx.products[metadata.id].displayName)
- end
- end
-end
-
local function init(...)
-- [Context]
- ctx = { gui = {}, image = {}, products = {}, theme = {}, config = {}, pages = {}, current = 1, scroll = 0,
- redraw = true }
-
- -- [Fonts]
- fontBDF = {}
- if fs.exists(sFont) and fs.isDir(sFont) then
- local fonts = fs.list(sFont)
- for i = 1, #fonts do
- local tmp = bdf.loadBDF(fs.combine(sFont, fonts[i]))
- local count, msg = bdf.checkFont(tmp)
- if count > 0 then
- printError("Could not load font \'" .. fonts[i] .. "\'!")
- for j = 1, #msg do
- printError(" * " .. msg[j])
- end
- sleep(1)
- else
- fontBDF[tmp.name] = tmp
- end
- end
- end
+ ctx = { products = {}, theme = {}, config = {}, pages = {} }
+ ctx.path = {
+ page = sPage
+ }
-- [Pages]
local pages = fs.list(sPage)
@@ -79,7 +48,6 @@
end
return false
end
-
-- theme
local col = { white = 0x1, orange = 0x2, magenta = 0x4, lightBlue = 0x8, yellow = 0x10, lime = 0x20, pink = 0x40,
grey = 0x80, lightGrey = 0x100, cyan = 0x200, purple = 0x400, blue = 0x800, brown = 0x1000, green = 0x2000,
@@ -91,19 +59,6 @@
if result then
ctx.theme = result
end
- -- bimg
- local files = fs.list(sImg)
- for i = 1, #files do
- if files[i]:sub(-4) == "bimg" then
- local f = fs.open(fs.combine(sImg, files[i]), 'r')
- local c = f.readAll()
- f.close()
- local result = loadStr(c, "return ", { colours = col, colors = inferiorcol })
- if result then
- ctx.image[files[i] or (#ctx.image + 1)] = result
- end
- end
- end
-- config
result = loadLuaFile(fs.combine(sData, "config.lua"))
if result then
@@ -115,168 +70,9 @@
ctx.products = result
end
- -- [Purchase]
- basalt.setVariable("purchase", purchase)
-
return ctx
end
----Saves the current proucts states into the file
----and loads them into the interface.
-local function updateProducts()
-end
-
----Checks if a given table has all keys inside it, building a chain with each other.
----@param ctx table The table to inspect
----@param ... any The keys to check
----@return boolean status true if all keys are there and false if not
-local function checkTableTree(ctx, ...)
- local tmp = ctx
- for _, key in pairs({ ... }) do
- if tmp[key] then
- tmp = tmp[key]
- else
- return false
- end
- end
- return true
-end
-
----Go through layout and replace stuff with our content
----@param page table The Basalt frame layout
-local function insertData(page, ctx)
- local layout = page:getLastLayout()
- local function repalceContent(layout)
- for _, object in pairs(layout) do
- -- Is frame?
- if object.addLayout then
- id = object:getName()
- -- Is frame for products?
- if id:find("products") then
- local listHeight = 1
- local nW, nH = object:getSize()
- for i, product in pairs(ctx.products) do
- if product.displayName and product.price and product.description then
- local item = object:addFrame(tostring(i))
- :setPosition(1, listHeight)
- :setSize(nW, 3)
- :setBackground(colors.gray)
- local offX = 0
- -- Image
- local bimg = {}
- for k, v in pairs(ctx.image["missing.bimg"]) do
- bimg[k] = v
- end
- if product.bimg then
- if type(product.bimg) == "table" then
- bimg[1] = product.bimg
- elseif type(product.bimg) == "string" then
- bimg = fs.combine(sImg, product.bimg)
- end
- end
- if bimg then
- local img = item:addBimg()
- :setPosition(1, 1)
- :loadImage(bimg)
- local x, y = img:getSize()
- offX = x + 2
- end
- -- Title
- item:addLabel()
- :setText(product.displayName)
- :setPosition(2 + offX, 1)
- :setSize(1, nW - (6 + offX), 1)
- :setBackground(colors.gray)
- -- Description
- item:addLabel()
- :setText(product.description)
- :setPosition(2 + offX, 2)
- :setSize(2, nW - (6 + offX), 1)
- :setForeground(colors.lightGray)
- :setBackground(colors.gray)
- -- Button
- item:addButton()
- :setText("BUY")
- :setPosition(nW - 6, 1)
- :setSize(7, 3)
- :setForeground(colors.white)
- :setBackground(colors.green)
- :setMetadata({
- id = i
- })
- :onClick(purchase)
-
-
- listHeight = listHeight + 4
- end
- end
- object:setSize(nW, listHeight)
- -- Look into frame for other stuff
- else
- local subLayout = object:getLastLayout()
- repalceContent(subLayout)
- end
- -- Is something else we are looking for?
- elseif object.setText then
- local id = object:getName()
- local txt = object:getValue()
- if id:find("subtitle") then
- if checkTableTree(ctx, "config", "details", "description") then
- object:setText(string.format(txt, ctx.config.details.description))
- end
- elseif id:find("title") then
- if checkTableTree(ctx, "config", "details", "title") then
- object:setText(string.format(txt, ctx.config.details.title))
- end
- end
- end
- end
- end
-
- repalceContent(layout)
-end
-
-local function main(ctx)
- local base = basalt.createFrame()
- :setTheme(ctx.theme)
- :addLayout(fs.combine(sPage, "index.xml"))
-
- local sCurPage = ""
- parallel.waitForAny(
- basalt.autoUpdate,
- function()
- local menubar = base:getDeepObject("main-menubar")
- local displayPage = base:getDeepObject("main-content")
-
- if not (menubar or displayPage) then
- return printError("Content is missing in index.xml!\nMake sure the following things are there:\n * Menubar | id=\"main-menubar\"\n * Frame | id=\"main-content\"")
- end
-
- while true do
- -- Change pages
- local tmpPage = menubar:getItem(menubar:getItemIndex()).text
- if tmpPage ~= sCurPage then
- sCurPage = tmpPage
- local oldLayout = displayPage:getLastLayout()
- for _, v in pairs(oldLayout) do
- displayPage:removeObject(v)
- end
-
- displayPage:addLayoutFromString(ctx.pages[sCurPage:lower() .. ".xml"])
- insertData(displayPage, ctx)
- end
-
- -- Update products
- if updateContent then
-
- updateContent = false
- end
- sleep()
- end
- end
- )
-end
-
-- INIT
local noErrors = true
local args = table.pack(...)
@@ -289,9 +85,9 @@
-- MAIN
if noErrors then
- xpcall(function()
- main(ctx)
- end, function(err)
+ local frontend, err = loadfile(fs.combine(sSrc, "frontend.lua"), "t", _ENV)
+ if not frontend then
printError(err)
- end)
-end
+ end
+ frontend(ctx)
+end
\ No newline at end of file
diff --git a/src/libs/Basalt/Frame.lua b/src/libs/Basalt/Frame.lua
deleted file mode 100644
index c5be088..0000000
--- a/src/libs/Basalt/Frame.lua
+++ /dev/null
@@ -1,1112 +0,0 @@
-local Object = require("Object")
-local _OBJECTS = require("loadObjects")
-local BasaltDraw = require("basaltDraw")
-local utils = require("utils")
-local layout = require("layout")
-local uuid = utils.uuid
-local rpairs = utils.rpairs
-local xmlValue = utils.getValueFromXML
-local tableCount = utils.tableCount
-
-local sub,min,max = string.sub,math.min,math.max
-
-return function(name, parent, pTerm, basalt)
- -- Frame
- local base = Object(name)
- local objectType = "Frame"
- local objects = {}
- local objZIndex = {}
- local object = {}
- local events = {}
- local eventZIndex = {}
- local variables = {}
- local theme = {}
- local dynamicValues = {}
- local dynValueId = 0
- local termObject = pTerm or term.current()
-
- local monSide = ""
- local isMonitor = false
- local monitorAttached = false
- local dragXOffset = 0
- local dragYOffset = 0
- local isScrollable = false
- local scrollAmount = 0
- local mirrorActive = false
- local mirrorAttached = false
- local mirrorSide = ""
- local isMovable = false
- local isDragging =false
-
- local focusedObjectCache
- local focusedObject
- local autoSize = true
- local autoScroll = true
- local initialized = false
-
- local activeEvents = {}
-
- base:setZIndex(10)
-
- local basaltDraw = BasaltDraw(termObject)
-
- local cursorBlink = false
- local xCursor = 1
- local yCursor = 1
- local cursorColor = colors.white
-
- local xOffset, yOffset = 0, 0
-
- local lastXMLReferences = {}
-
- local function xmlDefaultValues(data, obj)
- if(obj~=nil)then
- obj:setValuesByXMLData(data)
- end
- end
-
- local function addXMLObjectType(tab, f, self)
- if(tab~=nil)then
- if(tab.properties~=nil)then tab = {tab} end
-
- for k,v in pairs(tab)do
- local obj = f(self, v["@id"] or uuid())
- table.insert(lastXMLReferences, obj)
- xmlDefaultValues(v, obj)
- end
- end
- end
-
- local function getObject(name)
- for _, value in pairs(objects) do
- for _, b in pairs(value) do
- if (b:getName() == name) then
- return b
- end
- end
- end
- end
- local function getDeepObject(name)
- local o = getObject(name)
- if(o~=nil)then return o end
- for _, value in pairs(objects) do
- for _, b in pairs(value) do
- if (b:getType() == "Frame") then
- local oF = b:getDeepObject(name)
- if(oF~=nil)then return oF end
- end
- end
- end
- end
-
- local function addObject(obj)
- local zIndex = obj:getZIndex()
- if (getObject(obj.name) ~= nil) then
- return nil
- end
- if (objects[zIndex] == nil) then
- for x = 1, #objZIndex + 1 do
- if (objZIndex[x] ~= nil) then
- if (zIndex == objZIndex[x]) then
- break
- end
- if (zIndex > objZIndex[x]) then
- table.insert(objZIndex, x, zIndex)
- break
- end
- else
- table.insert(objZIndex, zIndex)
- end
- end
- if (#objZIndex <= 0) then
- table.insert(objZIndex, zIndex)
- end
- objects[zIndex] = {}
- end
- obj.parent = object
- if(obj.init~=nil)then
- obj:init()
- end
- table.insert(objects[zIndex], obj)
- return obj
- end
-
- local function removeEvents(self, obj)
- for a, b in pairs(events) do
- for c, d in pairs(b) do
- for key, value in pairs(d) do
- if (value == obj) then
- table.remove(events[a][c], key)
- if(self.parent~=nil)then
- if(tableCount(events[a])<=0)then
- self.parent:removeEvent(a, self)
- end
- end
- end
- end
- end
- end
- end
-
- local function removeObject(obj)
- for a, b in pairs(objects) do
- for key, value in pairs(b) do
- if (value == obj) then
- table.remove(objects[a], key)
- removeEvents(object, obj)
- return true;
- end
- end
- end
- return false
- end
-
- local function getEvent(self, event, name)
- for _, value in pairs(events[event]) do
- for _, b in pairs(value) do
- if (b:getName() == name) then
- return b
- end
- end
- end
- end
-
- local function addEvent(self, event, obj)
- local zIndex = obj:getZIndex()
- if(events[event]==nil)then events[event] = {} end
- if(eventZIndex[event]==nil)then eventZIndex[event] = {} end
- if (getEvent(self, event, obj.name) ~= nil) then
- return nil
- end
- if(self.parent~=nil)then
- self.parent:addEvent(event, self)
- end
- activeEvents[event] = true
- if (events[event][zIndex] == nil) then
- for x = 1, #eventZIndex[event] + 1 do
- if (eventZIndex[event][x] ~= nil) then
- if (zIndex == eventZIndex[event][x]) then
- break
- end
- if (zIndex > eventZIndex[event][x]) then
- table.insert(eventZIndex[event], x, zIndex)
- break
- end
- else
- table.insert(eventZIndex[event], zIndex)
- end
- end
- if (#eventZIndex[event] <= 0) then
- table.insert(eventZIndex[event], zIndex)
- end
- events[event][zIndex] = {}
- end
- table.insert(events[event][zIndex], obj)
- return obj
- end
-
- local function removeEvent(self, event, obj)
- if(events[event]~=nil)then
- for a, b in pairs(events[event]) do
- for key, value in pairs(b) do
- if (value == obj) then
- table.remove(events[event][a], key)
- if(#events[event][a]<=0)then
- events[event][a] = nil
- if(self.parent~=nil)then
- if(tableCount(events[event])<=0)then
- activeEvents[event] = false
- self.parent:removeEvent(event, self)
- end
- end
- end
- return true;
- end
- end
- end
- end
- return false
- end
-
- local function stringToNumber(str)
- local ok, err = pcall(load("return " .. str))
- if not(ok)then error(str.." is not a valid dynamic code") end
- return load("return " .. str)()
- end
-
- local function newDynamicValue(_, obj, str)
- for k,v in pairs(dynamicValues)do
- if(v[2]==str)and(v[4]==obj)then
- return v
- end
- end
- dynValueId = dynValueId + 1
- dynamicValues[dynValueId] = {0, str, {}, obj, dynValueId}
- return dynamicValues[dynValueId]
- end
-
- local function dynValueGetObjects(obj, str)
- local names = {}
- local t = {}
- for v in str:gmatch("%a+%.x") do
- local name = v:gsub("%.x", "")
- if(name~="self")and(name~="parent")then
- table.insert(names, name) end
- end
- for v in str:gmatch("%w+%.y") do
- local name = v:gsub("%.y", "")
- if(name~="self")and(name~="parent")then table.insert(names, name) end
- end
- for v in str:gmatch("%a+%.w") do
- local name = v:gsub("%.w", "")
- if(name~="self")and(name~="parent")then
- table.insert(names, name)
-
- end
- end
- for v in str:gmatch("%a+%.h") do
- local name = v:gsub("%.h", "")
- if(name~="self")and(name~="parent")then
- table.insert(names, name) end
- end
- for k,v in pairs(names)do
- t[v] = getObject(v)
- if(t[v]==nil)then
- error("Dynamic Values - unable to find object "..v)
- end
- end
- t["self"] = obj
- t["parent"] = obj:getParent()
- return t
- end
-
- local function dynValueObjectToNumber(str, objList)
- local newStr = str
- for v in str:gmatch("%w+%.x") do
- newStr = newStr:gsub(v, objList[v:gsub("%.x", "")]:getX())
- end
- for v in str:gmatch("%w+%.y") do
- newStr = newStr:gsub(v, objList[v:gsub("%.y", "")]:getY())
- end
- for v in str:gmatch("%w+%.w") do
- newStr = newStr:gsub(v, objList[v:gsub("%.w", "")]:getWidth())
- end
- for v in str:gmatch("%w+%.h") do
- newStr = newStr:gsub(v, objList[v:gsub("%.h", "")]:getHeight())
- end
- return newStr
- end
-
-
- local function recalculateDynamicValues(self)
- if(#dynamicValues>0)then
- for n=1,dynValueId do
- if(dynamicValues[n]~=nil)then
- local numberStr
- if(#dynamicValues[n][3]<=0)then dynamicValues[n][3] = dynValueGetObjects(dynamicValues[n][4], dynamicValues[n][2]) end
- numberStr = dynValueObjectToNumber(dynamicValues[n][2], dynamicValues[n][3])
- dynamicValues[n][1] = stringToNumber(numberStr)
- if(dynamicValues[n][4]:getType()=="Frame")then
- dynamicValues[n][4]:recalculateDynamicValues()
- end
- end
- end
- for _, index in pairs(objZIndex) do
- if (objects[index] ~= nil) then
- for _, value in pairs(objects[index]) do
- if (value.eventHandler ~= nil) then
- value:eventHandler("dynamicValueEvent", self)
- end
- end
- end
- end
- end
- end
-
- local function getDynamicValue(id)
- return dynamicValues[id][1]
- end
-
- local function calculateMaxScroll(self)
- for _, value in pairs(objects) do
- for _, b in pairs(value) do
- if(b.getHeight~=nil)and(b.getY~=nil)then
- local h, y = b:getHeight(), b:getY()
- if (h + y - self:getHeight() > scrollAmount) then
- scrollAmount = max(h + y - self:getHeight(), 0)
- end
- end
- end
- end
- end
-
-
- local function focusSystem(self)
- if(focusedObject~=focusedObjectCache)then
- if(focusedObject~=nil)then
- focusedObject:loseFocusHandler()
- end
- if(focusedObjectCache~=nil)then
- focusedObjectCache:getFocusHandler()
- end
- focusedObject = focusedObjectCache
- end
- end
-
- object = {
- barActive = false,
- barBackground = colors.gray,
- barTextcolor = colors.black,
- barText = "New Frame",
- barTextAlign = "left",
-
- addEvent = addEvent,
- removeEvent = removeEvent,
- removeEvents = removeEvents,
- getEvent = getEvent,
-
- newDynamicValue = newDynamicValue,
- recalculateDynamicValues = recalculateDynamicValues,
- getDynamicValue = getDynamicValue,
-
- getType = function(self)
- return objectType
- end;
-
- setFocusedObject = function(self, obj)
- focusedObjectCache = obj
- focusSystem(self)
- return self
- end;
-
- getVariable = function(self, name)
- return basalt.getVariable(name)
- end,
-
- setSize = function(self, w, h, rel)
- base.setSize(self, w, h, rel)
- if(self.parent==nil)then
- basaltDraw = BasaltDraw(termObject)
- end
- for _, index in pairs(objZIndex) do
- if (objects[index] ~= nil) then
- for _, value in pairs(objects[index]) do
- if (value.eventHandler ~= nil) then
- value:eventHandler("basalt_resize", value, self)
- end
- end
- end
- end
- self:recalculateDynamicValues()
- autoSize = false
- return self
- end;
-
- setTheme = function(self, _theme, col)
- if(type(_theme)=="table")then
- theme = _theme
- elseif(type(_theme)=="string")then
- theme[_theme] = col
- end
- self:updateDraw()
- return self
- end,
-
- getTheme = function(self, name)
- return theme[name] or (self.parent~=nil and self.parent:getTheme(name) or basalt.getTheme(name))
- end,
-
- setPosition = function(self, x, y, rel)
- base.setPosition(self, x, y, rel)
- for _, index in pairs(objZIndex) do
- if (objects[index] ~= nil) then
- for _, value in pairs(objects[index]) do
- if (value.eventHandler ~= nil) then
- value:eventHandler("basalt_reposition", value, self)
- end
- end
- end
- end
- self:recalculateDynamicValues()
- return self
- end;
-
- getBasaltInstance = function(self)
- return basalt
- end,
-
- setOffset = function(self, xO, yO)
- xOffset = xO ~= nil and math.floor(xO < 0 and math.abs(xO) or -xO) or xOffset
- yOffset = yO ~= nil and math.floor(yO < 0 and math.abs(yO) or -yO) or yOffset
- self:updateDraw()
- return self
- end;
-
- getOffsetInternal = function(self)
- return xOffset, yOffset
- end;
-
- getOffset = function(self)
- return xOffset < 0 and math.abs(xOffset) or -xOffset, yOffset < 0 and math.abs(yOffset) or -yOffset
- end;
-
- removeFocusedObject = function(self)
- focusedObjectCache = nil
- focusSystem(self)
- return self
- end;
-
- getFocusedObject = function(self)
- return focusedObject
- end;
-
- setCursor = function(self, _blink, _xCursor, _yCursor, color)
- if(self.parent~=nil)then
- local obx, oby = self:getAnchorPosition()
- self.parent:setCursor(_blink or false, (_xCursor or 0)+obx-1, (_yCursor or 0)+oby-1, color or cursorColor)
- else
- local obx, oby = self:getAbsolutePosition(self:getAnchorPosition(self:getX(), self:getY(), true))
- cursorBlink = _blink or false
- if (_xCursor ~= nil) then
- xCursor = obx + _xCursor - 1
- end
- if (_yCursor ~= nil) then
- yCursor = oby + _yCursor - 1
- end
- cursorColor = color or cursorColor
- if (cursorBlink) then
- termObject.setTextColor(cursorColor)
- termObject.setCursorPos(xCursor, yCursor)
- termObject.setCursorBlink(cursorBlink)
- else
- termObject.setCursorBlink(false)
- end
- end
- return self
- end;
-
- setMovable = function(self, movable)
- if(self.parent~=nil)then
- isMovable = movable or not isMovable
- self.parent:addEvent("mouse_click", self)
- activeEvents["mouse_click"] = true
- self.parent:addEvent("mouse_up", self)
- activeEvents["mouse_up"] = true
- self.parent:addEvent("mouse_drag", self)
- activeEvents["mouse_drag"] = true
- end
- return self;
- end;
-
- setScrollable = function(self, scrollable)
- isScrollable = (scrollable or scrollable==nil) and true or false
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_scroll", self)
- end
- activeEvents["mouse_scroll"] = true
- return self
- end,
-
- setScrollAmount = function(self, max)
- scrollAmount = max or scrollAmount
- autoScroll = false
- return self
- end,
-
-
- getScrollAmount = function(self)
- return autoScroll and scrollAmount or calculateMaxScroll(self)
- end,
-
- show = function(self)
- base.show(self)
- if(self.parent==nil)then
- basalt.setActiveFrame(self)
- if(isMonitor)then
- basalt.setMonitorFrame(monSide, self)
- else
- basalt.setMainFrame(self)
- end
- end
- return self;
- end;
-
- hide = function (self)
- base.hide(self)
- if(self.parent==nil)then
- if(activeFrame == self)then activeFrame = nil end
- if(isMonitor)then
- if(basalt.getMonitorFrame(monSide) == self)then
- basalt.setActiveFrame(nil)
- end
- else
- if(basalt.getMainFrame() == self)then
- basalt.setMainFrame(nil)
- end
- end
- end
- return self
- end;
-
- addLayout = function(self, file)
- if(file~=nil)then
- if(fs.exists(file))then
- local f = fs.open(file, "r")
- local data = layout:ParseXmlText(f.readAll())
- f.close()
- lastXMLReferences = {}
- self:setValuesByXMLData(data)
- end
- end
- return self
- end,
-
- getLastLayout = function(self)
- return lastXMLReferences
- end,
-
- addLayoutFromString = function(self, str)
- if(str~=nil)then
- local data = layout:ParseXmlText(str)
- self:setValuesByXMLData(data)
- end
- return self
- end,
-
- setValuesByXMLData = function(self, data)
- base.setValuesByXMLData(self, data)
- if(xmlValue("movable", data)~=nil)then if(xmlValue("movable", data))then self:setMovable(true) end end
- if(xmlValue("scrollable", data)~=nil)then if(xmlValue("scrollable", data))then self:setScrollable(true) end end
- if(xmlValue("monitor", data)~=nil)then self:setMonitor(xmlValue("monitor", data)):show() end
- if(xmlValue("mirror", data)~=nil)then self:setMirror(xmlValue("mirror", data)) end
- if(xmlValue("bar", data)~=nil)then if(xmlValue("bar", data))then self:showBar(true) else self:showBar(false) end end
- if(xmlValue("barText", data)~=nil)then self.barText = xmlValue("barText", data) end
- if(xmlValue("barBG", data)~=nil)then self.barBackground = colors[xmlValue("barBG", data)] end
- if(xmlValue("barFG", data)~=nil)then self.barTextcolor = colors[xmlValue("barFG", data)] end
- if(xmlValue("barAlign", data)~=nil)then self.barTextAlign = xmlValue("barAlign", data) end
- if(xmlValue("layout", data)~=nil)then self:addLayout(xmlValue("layout", data)) end
- if(xmlValue("xOffset", data)~=nil)then self:setOffset(xmlValue("xOffset", data), yOffset) end
- if(xmlValue("yOffset", data)~=nil)then self:setOffset(yOffset, xmlValue("yOffset", data)) end
- if(xmlValue("scrollAmount", data)~=nil)then self:setScrollAmount(xmlValue("scrollAmount", data)) end
-
- local objectList = data:children()
-
- for k,v in pairs(objectList)do
- if(v.___name~="animation")then
- local name = v.___name:gsub("^%l", string.upper)
- if(_OBJECTS[name]~=nil)then
- addXMLObjectType(v, self["add"..name], self)
- end
- end
- end
-
- addXMLObjectType(data["frame"], self.addFrame, self)
- addXMLObjectType(data["animation"], self.addAnimation, self)
- return self
- end,
-
- showBar = function(self, showIt) -- deprecated
- self.barActive = showIt or not self.barActive
- self:updateDraw()
- return self
- end;
-
- setBar = function(self, text, bgCol, fgCol) -- deprecated
- self.barText = text or ""
- self.barBackground = bgCol or self.barBackground
- self.barTextcolor = fgCol or self.barTextcolor
- self:updateDraw()
- return self
- end;
-
- setBarTextAlign = function(self, align) -- deprecated
- self.barTextAlign = align or "left"
- self:updateDraw()
- return self
- end;
-
- setMirror = function(self, side)
- if(self.parent~=nil)then error("Frame has to be a base frame in order to attach a mirror.") end
- mirrorSide = side
- if(mirror~=nil)then
- basaltDraw.setMirror(mirror)
- end
- mirrorActive = true
- return self
- end,
-
- removeMirror = function(self)
- mirror = nil
- mirrorActive = false
- basaltDraw.setMirror(nil)
- return self
- end,
-
- setMonitor = function(self, side)
- if(side~=nil)and(side~=false)then
- if(peripheral.getType(side)=="monitor")then
- termObject = peripheral.wrap(side)
- monitorAttached = true
-
- end
- if(self.parent~=nil)then
- self.parent:removeObject(self)
- end
- isMonitor = true
- basalt.setMonitorFrame(side, self)
- else
- termObject = parentTerminal
- isMonitor = false
- if(basalt.getMonitorFrame(monSide)==self)then
- basalt.setMonitorFrame(monSide, nil)
- end
- end
- basaltDraw = BasaltDraw(termObject)
- self:setSize(termObject.getSize())
- autoSize = true
- monSide = side or nil
- self:updateDraw()
- return self;
- end;
-
- loseFocusHandler = function(self)
- base.loseFocusHandler(self)
- if(focusedObject~=nil)then focusedObject:loseFocusHandler() focusedObject = nil end
- end;
-
- getFocusHandler = function(self)
- base.getFocusHandler(self)
- if (self.parent ~= nil) then
- if(isMovable)then
- self.parent:removeEvents(self)
- self.parent:removeObject(self)
- self.parent:addObject(self)
- for k,v in pairs(activeEvents)do
- if(v)then
- self.parent:addEvent(k, self)
- end
- end
- self:updateDraw()
- end
- end
- if(focusedObject~=nil)then focusedObject:getFocusHandler() end
- end;
-
- eventHandler = function(self, event, p1, p2, p3, p4)
- base.eventHandler(self, event, p1, p2, p3, p4)
- if(events["other_event"]~=nil)then
- for _, index in ipairs(eventZIndex["other_event"]) do
- if (events["other_event"][index] ~= nil) then
- for _, value in rpairs(events["other_event"][index]) do
- if (value.eventHandler ~= nil) then
- if (value:eventHandler(event, p1, p2, p3, p4)) then
- return true
- end
- end
- end
- end
- end
- end
- if(autoSize)and not(isMonitor)then
- if(self.parent==nil)then
- if(event=="term_resize")then
- self:setSize(termObject.getSize())
- autoSize = true
- end
- end
- end
- if(isMonitor)then
- if(autoSize)then
- if(event=="monitor_resize")and(p1==monSide)then
- self:setSize(termObject.getSize())
- autoSize = true
- self:updateDraw()
- end
- end
- if(event == "peripheral")and(p1==monSide)then
- if(peripheral.getType(monSide)=="monitor")then
- monitorAttached = true
- termObject = peripheral.wrap(monSide)
- basaltDraw = BasaltDraw(termObject)
- self:updateDraw()
- end
- end
- if(event == "peripheral_detach")and(p1==monSide)then
- monitorAttached = false
- end
- end
- if(mirrorActive)then
- if(peripheral.getType(mirrorSide)=="monitor")then
- mirrorAttached = true
- basaltDraw.setMirror(peripheral.wrap(mirrorSide))
- end
- if(event == "peripheral_detach")and(p1==mirrorSide)then
- monitorAttached = false
- end
- if(event=="monitor_touch")and(mirrorSide==p1)then
- self:mouseHandler(1, p2, p3, true)
- end
- end
- if (event == "terminate")and(self.parent==nil)then
- basalt.stop()
- end
- end,
-
- mouseHandler = function(self, button, x, y)
- if(base.mouseHandler(self, button, x, y))then
- if(events["mouse_click"]~=nil)then
- self:setCursor(false)
- for _, index in ipairs(eventZIndex["mouse_click"]) do
- if (events["mouse_click"][index] ~= nil) then
- for _, value in rpairs(events["mouse_click"][index]) do
- if (value.mouseHandler ~= nil) then
- if (value:mouseHandler(button, x, y)) then
- focusSystem(self)
- return true
- end
- end
- end
- end
- end
- end
- if (isMovable) then
- local fx, fy = self:getAbsolutePosition(self:getAnchorPosition())
- if (x >= fx) and (x <= fx + self:getWidth() - 1) and (y == fy)then
- isDragging = true
- dragXOffset = fx - x
- dragYOffset = yOff and 1 or 0
- end
- end
- self:removeFocusedObject()
- return true
- end
- return false
- end,
-
- mouseUpHandler = function(self, button, x, y)
- if (isDragging) then
- isDragging = false
- end
- if(base.mouseUpHandler(self, button, x, y))then
- if(events["mouse_up"]~=nil)then
- for _, index in ipairs(eventZIndex["mouse_up"]) do
- if (events["mouse_up"][index] ~= nil) then
- for _, value in rpairs(events["mouse_up"][index]) do
- if (value.mouseUpHandler ~= nil) then
- if (value:mouseUpHandler(button, x, y)) then
- focusSystem(self)
- return true
- end
- end
- end
- end
- end
- end
- focusSystem(self)
- return true
- end
- return false
- end,
-
- scrollHandler = function(self, dir, x, y)
- if(base.scrollHandler(self, dir, x, y))then
- if(events["mouse_scroll"]~=nil)then
- for _, index in pairs(eventZIndex["mouse_scroll"]) do
- if (events["mouse_scroll"][index] ~= nil) then
- for _, value in rpairs(events["mouse_scroll"][index]) do
- if (value.scrollHandler ~= nil) then
- if (value:scrollHandler(dir, x, y)) then
- focusSystem(self)
- return true
- end
- end
- end
- end
- end
- end
- local cache = yOffset
- if(isScrollable)then
- calculateMaxScroll(self)
- if(dir>0)or(dir<0)then
- yOffset = max(min(yOffset-dir, 0),-scrollAmount)
- self:updateDraw()
- end
- end
- self:removeFocusedObject()
- if(yOffset==cache)then return false end
- return true
- end
- return false
- end,
-
- dragHandler = function(self, button, x, y)
- if (isDragging) then
- local xO, yO = self.parent:getOffsetInternal()
- xO = xO < 0 and math.abs(xO) or -xO
- yO = yO < 0 and math.abs(yO) or -yO
- local parentX = 1
- local parentY = 1
- if (self.parent ~= nil) then
- parentX, parentY = self.parent:getAbsolutePosition(self.parent:getAnchorPosition())
- end
- self:setPosition(x + dragXOffset - (parentX - 1) + xO, y + dragYOffset - (parentY - 1) + yO)
- self:updateDraw()
- return true
- end
- if(self:isVisible())and(self:isEnabled())then
- if(events["mouse_drag"]~=nil)then
- for _, index in ipairs(eventZIndex["mouse_drag"]) do
- if (events["mouse_drag"][index] ~= nil) then
- for _, value in rpairs(events["mouse_drag"][index]) do
- if (value.dragHandler ~= nil) then
- if (value:dragHandler(button, x, y)) then
- focusSystem(self)
- return true
- end
- end
- end
- end
- end
- end
- end
- focusSystem(self)
- base.dragHandler(self, button, x, y)
- return false
- end,
-
- keyHandler = function(self, key, isHolding)
- if (self:isFocused())or(self.parent==nil)then
- local val = self:getEventSystem():sendEvent("key", self, "key", key)
- if(val==false)then return false end
- if(events["key"]~=nil)then
- for _, index in pairs(eventZIndex["key"]) do
- if (events["key"][index] ~= nil) then
- for _, value in rpairs(events["key"][index]) do
- if (value.keyHandler ~= nil) then
- if (value:keyHandler(key, isHolding)) then
- return true
- end
- end
- end
- end
- end
- end
- end
- return false
- end,
-
- keyUpHandler = function(self, key)
- if (self:isFocused())or(self.parent==nil)then
- local val = self:getEventSystem():sendEvent("key_up", self, "key_up", key)
- if(val==false)then return false end
- if(events["key_up"]~=nil)then
- for _, index in pairs(eventZIndex["key_up"]) do
- if (events["key_up"][index] ~= nil) then
- for _, value in rpairs(events["key_up"][index]) do
- if (value.keyUpHandler ~= nil) then
- if (value:keyUpHandler(key)) then
- return true
- end
- end
- end
- end
- end
- end
- end
- return false
- end,
-
- charHandler = function(self, char)
- if (self:isFocused())or(self.parent==nil)then
- local val = self:getEventSystem():sendEvent("char", self, "char", char)
- if(val==false)then return false end
- if(events["char"]~=nil)then
- for _, index in pairs(eventZIndex["char"]) do
- if (events["char"][index] ~= nil) then
- for _, value in rpairs(events["char"][index]) do
- if (value.charHandler ~= nil) then
- if (value:charHandler(char)) then
- return true
- end
- end
- end
- end
- end
- end
- end
- return false
- end,
-
- setText = function(self, x, y, text)
- local obx, oby = self:getAnchorPosition()
- if (y >= 1) and (y <= self:getHeight()) then
- if (self.parent ~= nil) then
- self.parent:setText(max(x + (obx - 1), obx), oby + y - 1, sub(text, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- else
- basaltDraw.setText(max(x + (obx - 1), obx), oby + y - 1, sub(text, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- end
- end
- end;
-
- setBG = function(self, x, y, bgCol)
- local obx, oby = self:getAnchorPosition()
- if (y >= 1) and (y <= self:getHeight()) then
- if (self.parent ~= nil) then
- self.parent:setBG(max(x + (obx - 1), obx), oby + y - 1, sub(bgCol, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- else
- basaltDraw.setBG(max(x + (obx - 1), obx), oby + y - 1, sub(bgCol, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- end
- end
- end;
-
- setFG = function(self, x, y, fgCol)
- local obx, oby = self:getAnchorPosition()
- if (y >= 1) and (y <= self:getHeight()) then
- if (self.parent ~= nil) then
- self.parent:setFG(max(x + (obx - 1), obx), oby + y - 1, sub(fgCol, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- else
- basaltDraw.setFG(max(x + (obx - 1), obx), oby + y - 1, sub(fgCol, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)))
- end
- end
- end;
-
- writeText = function(self, x, y, text, bgCol, fgCol)
- local obx, oby = self:getAnchorPosition()
- if (y >= 1) and (y <= self:getHeight()) then
- if (self.parent ~= nil) then
- self.parent:writeText(max(x + (obx - 1), obx), oby + y - 1, sub(text, max(1 - x + 1, 1), self:getWidth() - x + 1), bgCol, fgCol)
- else
- basaltDraw.writeText(max(x + (obx - 1), obx), oby + y - 1, sub(text, max(1 - x + 1, 1), max(self:getWidth() - x + 1,1)), bgCol, fgCol)
- end
- end
- end;
-
- drawBackgroundBox = function(self, x, y, width, height, bgCol)
- local obx, oby = self:getAnchorPosition()
-
- height = (y < 1 and (height + y > self:getHeight() and self:getHeight() or height + y - 1) or (height + y > self:getHeight() and self:getHeight() - y + 1 or height))
- width = (x < 1 and (width + x > self:getWidth() and self:getWidth() or width + x - 1) or (width + x > self:getWidth() and self:getWidth() - x + 1 or width))
- if (self.parent ~= nil) then
- self.parent:drawBackgroundBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, bgCol)
- else
- basaltDraw.drawBackgroundBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, bgCol)
- end
- end;
-
- drawTextBox = function(self, x, y, width, height, symbol)
- local obx, oby = self:getAnchorPosition()
- height = (y < 1 and (height + y > self:getHeight() and self:getHeight() or height + y - 1) or (height + y > self:getHeight() and self:getHeight() - y + 1 or height))
- width = (x < 1 and (width + x > self:getWidth() and self:getWidth() or width + x - 1) or (width + x > self:getWidth() and self:getWidth() - x + 1 or width))
- if (self.parent ~= nil) then
- self.parent:drawTextBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, sub(symbol,1,1))
- else
- basaltDraw.drawTextBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, sub(symbol,1,1))
- end
- end;
-
- drawForegroundBox = function(self, x, y, width, height, fgCol)
- local obx, oby = self:getAnchorPosition()
- height = (y < 1 and (height + y > self:getHeight() and self:getHeight() or height + y - 1) or (height + y > self:getHeight() and self:getHeight() - y + 1 or height))
- width = (x < 1 and (width + x > self:getWidth() and self:getWidth() or width + x - 1) or (width + x > self:getWidth() and self:getWidth() - x + 1 or width))
- if (self.parent ~= nil) then
- self.parent:drawForegroundBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, fgCol)
- else
- basaltDraw.drawForegroundBox(max(x + (obx - 1), obx), max(y + (oby - 1), oby), width, height, fgCol)
- end
- end;
-
- draw = function(self, force)
- if(isMonitor)and not(monitorAttached)then return false end;
- if(self.parent==nil)then if(self:getDraw()==false)then return false end end
- if (base.draw(self))then
- local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
- local anchx, anchy = self:getAnchorPosition()
- local w,h = self:getSize()
- if (self.parent == nil) then
- if(self.bgColor~=false)then
- basaltDraw.drawBackgroundBox(anchx, anchy, w, h, self.bgColor)
- basaltDraw.drawTextBox(anchx, anchy, w, h, " ")
- end
- if(self.fgColor~=false)then basaltDraw.drawForegroundBox(anchx, anchy, w, h, self.fgColor) end
- end
- if (self.barActive) then
- if (self.parent ~= nil) then
- self.parent:writeText(anchx, anchy, utils.getTextHorizontalAlign(self.barText, w, self.barTextAlign), self.barBackground, self.barTextcolor)
- else
- basaltDraw.writeText(anchx, anchy, utils.getTextHorizontalAlign(self.barText, w, self.barTextAlign), self.barBackground, self.barTextcolor)
- end
- if(self:getBorder("left"))then
- if (self.parent ~= nil) then
- self.parent:drawBackgroundBox(anchx-1, anchy, 1, 1, self.barBackground)
- if(self.bgColor~=false)then
- self.parent:drawBackgroundBox(anchx-1, anchy+1, 1, h-1, self.bgColor)
- end
- end
- end
- if(self:getBorder("top"))then
- if (self.parent ~= nil) then
- self.parent:drawBackgroundBox(anchx-1, anchy-1, w+1, 1, self.barBackground)
- end
- end
- end
-
- for _, index in rpairs(objZIndex) do
- if (objects[index] ~= nil) then
- for _, value in pairs(objects[index]) do
- if (value.draw ~= nil) then
- value:draw()
- end
- end
- end
- end
- end
- end;
-
- updateTerm = function(self)
- if(isMonitor)and not(monitorAttached)then return false end;
- basaltDraw.update()
- end;
-
- addObject = function(self, obj)
- return addObject(obj)
- end;
-
- removeObject = function(self, obj)
- return removeObject(obj)
- end;
-
- getObject = function(self, obj)
- return getObject(obj)
- end;
- getDeepObject = function(self, name)
- return getDeepObject(name)
- end,
-
- addFrame = function(self, name)
- local obj = basalt.newFrame(name or uuid(), self, nil, basalt)
- return addObject(obj)
- end,
-
- init = function(self)
- if not(initialized)then
- if (parent ~= nil) then
- base.width, base.height = parent:getSize()
- self:setBackground(parent:getTheme("FrameBG"))
- self:setForeground(parent:getTheme("FrameText"))
- else
- base.width, base.height = termObject.getSize()
- self:setBackground(basalt.getTheme("BasaltBG"))
- self:setForeground(basalt.getTheme("BasaltText"))
- end
- initialized = true
- end
- end,
- }
- for k,v in pairs(_OBJECTS)do
- object["add"..k] = function(self, name)
- return addObject(v(name or uuid(), self))
- end
- end
- setmetatable(object, base)
- return object
-end
diff --git a/src/libs/Basalt/Object.lua b/src/libs/Basalt/Object.lua
deleted file mode 100644
index ccc7b6b..0000000
--- a/src/libs/Basalt/Object.lua
+++ /dev/null
@@ -1,867 +0,0 @@
-local basaltEvent = require("basaltEvent")
-local utils = require("utils")
-local split = utils.splitString
-local numberFromString = utils.numberFromString
-local xmlValue = utils.getValueFromXML
-
-return function(name)
- -- Base object
- local objectType = "Object" -- not changeable
- local object = {}
- local zIndex = 1
- local value
- local anchor = "topLeft"
- local ignOffset = false
- local isVisible = true
- local initialized = false
-
- local shadow = false
- local borderColors = {
- left = false,
- right = false,
- top = false,
- bottom = false
- }
-
- local shadowColor = colors.black
- local isEnabled = true
- local isDragging = false
- local dragStartX, dragStartY, dragXOffset, dragYOffset = 0, 0, 0, 0
-
- local draw = true
- local activeEvents = {}
-
- local eventSystem = basaltEvent()
-
- object = {
- x = 1,
- y = 1,
- width = 1,
- height = 1,
- bgColor = colors.black,
- bgSymbol = " ",
- bgSymbolColor = colors.black,
- fgColor = colors.white,
- transparentColor = false,
- name = name or "Object",
- parent = nil,
-
- show = function(self)
- isVisible = true
- self:updateDraw()
- return self
- end;
-
- hide = function(self)
- isVisible = false
- self:updateDraw()
- return self
- end,
-
- enable = function(self)
- isEnabled = true
- return self
- end,
-
- disable = function(self)
- isEnabled = false
- return self
- end,
-
- isEnabled = function(self)
- return isEnabled
- end,
-
- generateXMLEventFunction = function(self, func, val)
- local createF = function(str)
- if(str:sub(1,1)=="#")then
- local o = self:getBaseFrame():getDeepObject(str:sub(2,str:len()))
- if(o~=nil)and(o.internalObjetCall~=nil)then
- func(self,function()o:internalObjetCall()end)
- end
- else
- func(self,self:getBaseFrame():getVariable(str))
- end
- end
- if(type(val)=="string")then
- createF(val)
- elseif(type(val)=="table")then
- for k,v in pairs(val)do
- createF(v)
- end
- end
- return self
- end,
-
- setValuesByXMLData = function(self, data)
- local baseFrame = self:getBaseFrame()
- if(xmlValue("x", data)~=nil)then self:setPosition(xmlValue("x", data), self.y) end
- if(xmlValue("y", data)~=nil)then self:setPosition(self.x, xmlValue("y", data)) end
- if(xmlValue("width", data)~=nil)then self:setSize(xmlValue("width", data), self.height) end
- if(xmlValue("height", data)~=nil)then self:setSize(self.width, xmlValue("height", data)) end
- if(xmlValue("bg", data)~=nil)then self:setBackground(colors[xmlValue("bg", data)]) end
- if(xmlValue("fg", data)~=nil)then self:setForeground(colors[xmlValue("fg", data)]) end
- if(xmlValue("value", data)~=nil)then self:setValue(colors[xmlValue("value", data)]) end
- if(xmlValue("visible", data)~=nil)then if(xmlValue("visible", data))then self:show() else self:hide() end end
- if(xmlValue("enabled", data)~=nil)then if(xmlValue("enabled", data))then self:enable() else self:disable() end end
- if(xmlValue("zIndex", data)~=nil)then self:setZIndex(xmlValue("zIndex", data)) end
- if(xmlValue("anchor", data)~=nil)then self:setAnchor(xmlValue("anchor", data)) end
- if(xmlValue("shadowColor", data)~=nil)then self:setShadow(colors[xmlValue("shadowColor", data)]) end
- if(xmlValue("border", data)~=nil)then self:setBorder(colors[xmlValue("border", data)]) end
- if(xmlValue("borderLeft", data)~=nil)then borderColors["left"] = xmlValue("borderLeft", data) end
- if(xmlValue("borderTop", data)~=nil)then borderColors["top"] = xmlValue("borderTop", data) end
- if(xmlValue("borderRight", data)~=nil)then borderColors["right"] = xmlValue("borderRight", data) end
- if(xmlValue("borderBottom", data)~=nil)then borderColors["bottom"] = xmlValue("borderBottom", data) end
- if(xmlValue("borderColor", data)~=nil)then self:setBorder(colors[xmlValue("borderColor", data)]) end
- if(xmlValue("ignoreOffset", data)~=nil)then if(xmlValue("ignoreOffset", data))then self:ignoreOffset(true) end end
- if(xmlValue("onClick", data)~=nil)then self:generateXMLEventFunction(self.onClick, xmlValue("onClick", data)) end
- if(xmlValue("onClickUp", data)~=nil)then self:generateXMLEventFunction(self.onClickUp, xmlValue("onClickUp", data)) end
- if(xmlValue("onScroll", data)~=nil)then self:generateXMLEventFunction(self.onScroll, xmlValue("onScroll", data)) end
- if(xmlValue("onDrag", data)~=nil)then self:generateXMLEventFunction(self.onDrag, xmlValue("onDrag", data)) end
- if(xmlValue("onKey", data)~=nil)then self:generateXMLEventFunction(self.onKey, xmlValue("onKey", data)) end
- if(xmlValue("onKeyUp", data)~=nil)then self:generateXMLEventFunction(self.onKeyUp, xmlValue("onKeyUp", data)) end
- if(xmlValue("onChange", data)~=nil)then self:generateXMLEventFunction(self.onChange, xmlValue("onChange", data)) end
- if(xmlValue("onResize", data)~=nil)then self:generateXMLEventFunction(self.onResize, xmlValue("onResize", data)) end
- if(xmlValue("onReposition", data)~=nil)then self:generateXMLEventFunction(self.onReposition, xmlValue("onReposition", data)) end
- if(xmlValue("onEvent", data)~=nil)then self:generateXMLEventFunction(self.onEvent, xmlValue("onEvent", data)) end
- if(xmlValue("onGetFocus", data)~=nil)then self:generateXMLEventFunction(self.onGetFocus, xmlValue("onGetFocus", data)) end
- if(xmlValue("onLoseFocus", data)~=nil)then self:generateXMLEventFunction(self.onLoseFocus, xmlValue("onLoseFocus", data)) end
- self:updateDraw()
- return self
- end,
-
- isVisible = function(self)
- return isVisible
- end;
-
- setFocus = function(self)
- if (self.parent ~= nil) then
- self.parent:setFocusedObject(self)
- end
- return self
- end;
-
- setZIndex = function(self, index)
- zIndex = index
- if (self.parent ~= nil) then
- self.parent:removeObject(self)
- self.parent:addObject(self)
- self:updateEventHandlers()
- end
-
- return self
- end,
-
- updateEventHandlers = function(self)
- for k,v in pairs(activeEvents)do
- if(v)then
- self.parent:addEvent(k, self)
- end
- end
- end,
-
- getZIndex = function(self)
- return zIndex;
- end;
-
- getType = function(self)
- return objectType
- end;
-
- getName = function(self)
- return self.name
- end;
-
- remove = function(self)
- if (self.parent ~= nil) then
- self.parent:removeObject(self)
- end
- self:updateDraw()
- return self
- end;
-
- setParent = function(self, frame)
- if (frame.getType ~= nil and frame:getType() == "Frame") then
- self:remove()
- frame:addObject(self)
- if (self.draw) then
- self:show()
- end
- end
- return self
- end;
-
- setValue = function(self, _value)
- if (value ~= _value) then
- value = _value
- self:updateDraw()
- self:valueChangedHandler()
- end
- return self
- end;
-
- getValue = function(self)
- return value
- end;
-
- getDraw = function(self)
- return draw
- end;
-
- updateDraw = function(self, change)
- draw = change
- if(change == nil)then draw = true end
- if(draw)then if(self.parent~=nil)then self.parent:updateDraw() end end
- return self
- end;
-
-
- getEventSystem = function(self)
- return eventSystem
- end;
-
-
- getParent = function(self)
- return self.parent
- end;
-
- setPosition = function(self, xPos, yPos, rel)
- if(type(xPos)=="number")then
- self.x = rel and self:getX()+xPos or xPos
- end
- if(type(yPos)=="number")then
- self.y = rel and self:getY()+yPos or yPos
- end
- if(self.parent~=nil)then
- if(type(xPos)=="string")then
- self.x = self.parent:newDynamicValue(self, xPos)
- end
- if(type(yPos)=="string")then
- self.y = self.parent:newDynamicValue(self, yPos)
- end
- self.parent:recalculateDynamicValues()
- end
- eventSystem:sendEvent("basalt_reposition", self)
- self:updateDraw()
- return self
- end;
-
- getX = function(self)
- return type(self.x) == "number" and self.x or math.floor(self.x[1]+0.5)
- end;
-
- getY = function(self)
- return type(self.y) == "number" and self.y or math.floor(self.y[1]+0.5)
- end;
-
- getPosition = function(self)
- return self:getX(), self:getY()
- end;
-
- getVisibility = function(self)
- return isVisible
- end;
-
- setVisibility = function(self, _isVisible)
- isVisible = _isVisible or not isVisible
- self:updateDraw()
- return self
- end;
-
- setSize = function(self, width, height, rel)
- if(type(width)=="number")then
- self.width = rel and self.width+width or width
- end
- if(type(height)=="number")then
- self.height = rel and self.height+height or height
- end
- if(self.parent~=nil)then
- if(type(width)=="string")then
- self.width = self.parent:newDynamicValue(self, width)
- end
- if(type(height)=="string")then
- self.height = self.parent:newDynamicValue(self, height)
- end
- self.parent:recalculateDynamicValues()
- end
- eventSystem:sendEvent("basalt_resize", self)
- self:updateDraw()
- return self
- end;
-
- getHeight = function(self)
- return type(self.height) == "number" and self.height or math.floor(self.height[1]+0.5)
- end;
-
- getWidth = function(self)
- return type(self.width) == "number" and self.width or math.floor(self.width[1]+0.5)
- end;
-
- getSize = function(self)
- return self:getWidth(), self:getHeight()
- end;
-
- calculateDynamicValues = function(self)
- if(type(self.width)=="table")then self.width:calculate() end
- if(type(self.height)=="table")then self.height:calculate() end
- if(type(self.x)=="table")then self.x:calculate() end
- if(type(self.y)=="table")then self.y:calculate() end
- self:updateDraw()
- return self
- end,
-
- setBackground = function(self, color, symbol, symbolCol)
- self.bgColor = color or false
- self.bgSymbol = symbol or (self.bgColor~=false and self.bgSymbol or false)
- self.bgSymbolColor = symbolCol or self.bgSymbolColor
- self:updateDraw()
- return self
- end;
-
- setTransparent = function(self, color)
- self.transparentColor = color or false
- self.bgSymbol = false
- self.bgSymbolColor = false
- self:updateDraw()
- return self
- end;
-
- getBackground = function(self)
- return self.bgColor
- end;
-
- setForeground = function(self, color)
- self.fgColor = color or false
- self:updateDraw()
- return self
- end;
-
- getForeground = function(self)
- return self.fgColor
- end;
-
- setShadow = function(self, color)
- if(color==false)then
- shadow = false
- else
- shadowColor = color
- shadow = true
- end
- self:updateDraw()
- return self
- end;
-
- isShadowActive = function(self)
- return shadow;
- end;
-
- setBorder = function(self, ...)
- if(...~=nil)then
- local t = {...}
- for k,v in pairs(t)do
- if(v=="left")or(#t==1)then
- borderColors["left"] = t[1]
- end
- if(v=="top")or(#t==1)then
- borderColors["top"] = t[1]
- end
- if(v=="right")or(#t==1)then
- borderColors["right"] = t[1]
- end
- if(v=="bottom")or(#t==1)then
- borderColors["bottom"] = t[1]
- end
- end
- end
- self:updateDraw()
- return self
- end;
-
- getBorder = function(self, side)
- if(side=="left")then
- return borderLeft;
- end
- if(side=="top")then
- return borderTop;
- end
- if(side=="right")then
- return borderRight;
- end
- if(side=="bottom")then
- return borderBottom;
- end
- end;
-
- draw = function(self)
- if (isVisible)then
- if(self.parent~=nil)then
- local x, y = self:getAnchorPosition()
- local w,h = self:getSize()
- local wP,hP = self.parent:getSize()
- if(x+w<1)or(x>wP)or(y+h<1)or(y>hP)then return false end
- if(self.transparentColor~=false)then
- self.parent:drawForegroundBox(x, y, w, h, self.transparentColor)
- end
- if(self.bgColor~=false)then
- self.parent:drawBackgroundBox(x, y, w, h, self.bgColor)
- end
- if(self.bgSymbol~=false)then
- self.parent:drawTextBox(x, y, w, h, self.bgSymbol)
- if(self.bgSymbol~=" ")then
- self.parent:drawForegroundBox(x, y, w, h, self.bgSymbolColor)
- end
- end
- if(shadow)then
- self.parent:drawBackgroundBox(x+1, y+h, w, 1, shadowColor)
- self.parent:drawBackgroundBox(x+w, y+1, 1, h, shadowColor)
- self.parent:drawForegroundBox(x+1, y+h, w, 1, shadowColor)
- self.parent:drawForegroundBox(x+w, y+1, 1, h, shadowColor)
- end
- if(borderColors["left"]~=false)then
- self.parent:drawTextBox(x-1, y, 1, h, "\149")
- self.parent:drawBackgroundBox(x-1, y, 1, h, self.bgColor)
- self.parent:drawForegroundBox(x-1, y, 1, h, borderColors["left"])
- end
- if(borderColors["left"]~=false)and(borderColors["top"]~=false)then
- self.parent:drawTextBox(x-1, y-1, 1, 1, "\151")
- self.parent:drawBackgroundBox(x-1, y-1, 1, 1, self.bgColor)
- self.parent:drawForegroundBox(x-1, y-1, 1, 1, borderColors["left"])
- end
- if(borderColors["top"]~=false)then
-
- self.parent:drawTextBox(x, y-1, w, 1, "\131")
- self.parent:drawBackgroundBox(x, y-1, w, 1, self.bgColor)
- self.parent:drawForegroundBox(x, y-1, w, 1, borderColors["top"])
- end
- if(borderColors["top"]~=false)and(borderColors["right"]~=false)then
- self.parent:drawTextBox(x+w, y-1, 1, 1, "\148")
- self.parent:drawForegroundBox(x+w, y-1, 1, 1, self.bgColor)
- self.parent:drawBackgroundBox(x+w, y-1, 1, 1, borderColors["right"])
- end
- if(borderColors["right"]~=false)then
- self.parent:drawTextBox(x+w, y, 1, h, "\149")
- self.parent:drawForegroundBox(x+w, y, 1, h, self.bgColor)
- self.parent:drawBackgroundBox(x+w, y, 1, h, borderColors["right"])
- end
- if(borderColors["right"]~=false)and(borderColors["bottom"]~=false)then
- self.parent:drawTextBox(x+w, y+h, 1, 1, "\133")
- self.parent:drawForegroundBox(x+w, y+h, 1, 1, self.bgColor)
- self.parent:drawBackgroundBox(x+w, y+h, 1, 1, borderColors["right"])
- end
- if(borderColors["bottom"]~=false)then
- self.parent:drawTextBox(x, y+h, w, 1, "\143")
- self.parent:drawForegroundBox(x, y+h, w, 1, self.bgColor)
- self.parent:drawBackgroundBox(x, y+h, w, 1, borderColors["bottom"])
- end
- if(borderColors["bottom"]~=false)and(borderColors["left"]~=false)then
- self.parent:drawTextBox(x-1, y+h, 1, 1, "\138")
- self.parent:drawForegroundBox(x-1, y+h, 1, 1, self.bgColor)
- self.parent:drawBackgroundBox(x-1, y+h, 1, 1, borderColors["left"])
- end
- end
- draw = false
- return true
- end
- return false
- end;
-
-
- getAbsolutePosition = function(self, x, y)
- -- relative position to absolute position
- if (x == nil) or (y == nil) then
- x, y = self:getAnchorPosition()
- end
-
- if (self.parent ~= nil) then
- local fx, fy = self.parent:getAbsolutePosition()
- x = fx + x - 1
- y = fy + y - 1
- end
- return x, y
- end;
-
- getAnchorPosition = function(self, x, y, ignOff)
- if (x == nil) then
- x = self:getX()
- end
- if (y == nil) then
- y = self:getY()
- end
- if(self.parent~=nil)then
- local pw,ph = self.parent:getSize()
- if (anchor == "top") then
- x = math.floor(pw/2) + x - 1
- elseif(anchor == "topRight") then
- x = pw + x - 1
- elseif(anchor == "right") then
- x = pw + x - 1
- y = math.floor(ph/2) + y - 1
- elseif(anchor == "bottomRight") then
- x = pw + x - 1
- y = ph + y - 1
- elseif(anchor == "bottom") then
- x = math.floor(pw/2) + x - 1
- y = ph + y - 1
- elseif(anchor == "bottomLeft") then
- y = ph + y - 1
- elseif(anchor == "left") then
- y = math.floor(ph/2) + y - 1
- elseif(anchor == "center") then
- x = math.floor(pw/2) + x - 1
- y = math.floor(ph/2) + y - 1
- end
-
- local xO, yO = self.parent:getOffsetInternal()
- if not(ignOffset or ignOff) then
- return x+xO, y+yO
- end
- end
- return x, y
- end;
-
- ignoreOffset = function(self, ignore)
- ignOffset = ignore
- if(ignore==nil)then ignOffset = true end
- return self
- end;
-
- getBaseFrame = function(self)
- if(self.parent~=nil)then
- return self.parent:getBaseFrame()
- end
- return self
- end;
-
- setAnchor = function(self, newAnchor)
- anchor = newAnchor
- self:updateDraw()
- return self
- end;
-
- getAnchor = function(self)
- return anchor
- end;
-
- onChange = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("value_changed", v)
- end
- end
- return self
- end;
-
- onClick = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("mouse_click", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_click", self)
- activeEvents["mouse_click"] = true
- end
- return self
- end;
-
- onClickUp = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("mouse_up", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_up", self)
- activeEvents["mouse_up"] = true
- end
- return self
- end;
-
-
- onScroll = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("mouse_scroll", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_scroll", self)
- activeEvents["mouse_scroll"] = true
- end
- return self
- end;
-
- onDrag = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("mouse_drag", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_drag", self)
- activeEvents["mouse_drag"] = true
- self.parent:addEvent("mouse_click", self)
- activeEvents["mouse_click"] = true
- self.parent:addEvent("mouse_up", self)
- activeEvents["mouse_up"] = true
- end
- return self
- end;
-
- onEvent = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("other_event", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("other_event", self)
- activeEvents["other_event"] = true
- end
- return self
- end;
-
- onKey = function(self, ...)
- if(isEnabled)then
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("key", v)
- self:registerEvent("char", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("key", self)
- self.parent:addEvent("char", self)
- activeEvents["key"] = true
- activeEvents["char"] = true
- end
- end
- return self
- end;
-
- onResize = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("basalt_resize", v)
- end
- end
- return self
- end;
-
- onReposition = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("basalt_reposition", v)
- end
- end
- return self
- end;
-
- onKeyUp = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("key_up", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("key_up", self)
- activeEvents["key_up"] = true
- end
- return self
- end;
-
- isFocused = function(self)
- if (self.parent ~= nil) then
- return self.parent:getFocusedObject() == self
- end
- return false
- end;
-
- onGetFocus = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("get_focus", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_click", self)
- activeEvents["mouse_click"] = true
- end
- return self
- end;
-
- onLoseFocus = function(self, ...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- self:registerEvent("lose_focus", v)
- end
- end
- if(self.parent~=nil)then
- self.parent:addEvent("mouse_click", self)
- activeEvents["mouse_click"] = true
- end
- return self
- end;
-
- registerEvent = function(self, event, func)
- return eventSystem:registerEvent(event, func)
- end;
-
- removeEvent = function(self, event, index)
- return eventSystem:removeEvent(event, index)
- end;
-
- sendEvent = function(self, event, ...)
- return eventSystem:sendEvent(event, self, ...)
- end;
-
- isCoordsInObject = function(self, x, y)
- if(isVisible)and(isEnabled)then
- local objX, objY = self:getAbsolutePosition(self:getAnchorPosition())
- local w, h = self:getSize()
- if (objX <= x) and (objX + w > x) and (objY <= y) and (objY + h > y) then
- return true
- end
- end
- return false
- end,
-
- mouseHandler = function(self, button, x, y, isMon)
- if(self:isCoordsInObject(x, y))then
- local val = eventSystem:sendEvent("mouse_click", self, "mouse_click", button, x, y, isMon)
- if(val==false)then return false end
- if(self.parent~=nil)then
- self.parent:setFocusedObject(self)
- end
- isDragging = true
- dragStartX, dragStartY = x, y
- return true
- end
- return false
- end,
-
- mouseUpHandler = function(self, button, x, y)
- isDragging = false
- if(self:isCoordsInObject(x, y))then
- local val = eventSystem:sendEvent("mouse_up", self, "mouse_up", button, x, y)
- if(val==false)then return false end
- return true
- end
- return false
- end,
-
- dragHandler = function(self, button, x, y)
- if(isDragging)then
- local xO, yO, parentX, parentY = 0, 0, 1, 1
- if (self.parent ~= nil) then
- xO, yO = self.parent:getOffsetInternal()
- xO = xO < 0 and math.abs(xO) or -xO
- yO = yO < 0 and math.abs(yO) or -yO
- parentX, parentY = self.parent:getAbsolutePosition(self.parent:getAnchorPosition())
- end
- local dX, dY = x + dragXOffset - (parentX - 1) + xO, y + dragYOffset - (parentY - 1) + yO
- local val = eventSystem:sendEvent("mouse_drag", self, button, dX, dY, dragStartX-x, dragStartY-y, x, y)
- local objX, objY = self:getAbsolutePosition(self:getAnchorPosition())
- dragStartX, dragStartY = x, y
- if(val~=nil)then return val end
- if(self.parent~=nil)then
- self.parent:setFocusedObject(self)
- end
- return true
- end
-
- if(self:isCoordsInObject(x, y))then
- local objX, objY = self:getAbsolutePosition(self:getAnchorPosition())
- dragStartX, dragStartY = x, y
- dragXOffset, dragYOffset = objX - x, objY - y
- end
- return false
- end,
-
- scrollHandler = function(self, dir, x, y)
- if(self:isCoordsInObject(x, y))then
- local val = eventSystem:sendEvent("mouse_scroll", self, "mouse_scroll", dir, x, y)
- if(val==false)then return false end
- if(self.parent~=nil)then
- self.parent:setFocusedObject(self)
- end
- return true
- end
- return false
- end,
-
- keyHandler = function(self, key, isHolding)
- if(isEnabled)and(isVisible)then
- if (self:isFocused()) then
- local val = eventSystem:sendEvent("key", self, "key", key, isHolding)
- if(val==false)then return false end
- return true
- end
- end
- return false
- end;
-
- keyUpHandler = function(self, key)
- if(isEnabled)and(isVisible)then
- if (self:isFocused()) then
- local val = eventSystem:sendEvent("key_up", self, "key_up", key)
- if(val==false)then return false end
- return true
- end
- end
- return false
- end;
-
- charHandler = function(self, char)
- if(isEnabled)and(isVisible)then
- if (self:isFocused()) then
- local val = eventSystem:sendEvent("char", self, "char", char)
- if(val==false)then return false end
- return true
- end
- end
- return false
- end,
-
- valueChangedHandler = function(self)
- eventSystem:sendEvent("value_changed", self, value)
- end;
-
- eventHandler = function(self, event, p1, p2, p3, p4)
- local val = eventSystem:sendEvent("other_event", self, event, p1, p2, p3, p4)
- if(val~=nil)then return val end
- return true
- end;
-
- getFocusHandler = function(self)
- local val = eventSystem:sendEvent("get_focus", self)
- if(val~=nil)then return val end
- return true
- end;
-
- loseFocusHandler = function(self)
- isDragging = false
- local val = eventSystem:sendEvent("lose_focus", self)
- if(val~=nil)then return val end
- return true
- end;
-
- init = function(self)
- if(self.parent~=nil)then
- for k,v in pairs(activeEvents)do
- if(v)then
- self.parent:addEvent(k, self)
- end
- end
- end
- if not(initialized)then
- initialized = true
- return true
- end
- end
-
- }
-
- object.__index = object
- return object
-end
\ No newline at end of file
diff --git a/src/libs/Basalt/init.lua b/src/libs/Basalt/init.lua
deleted file mode 100644
index bb8e6b0..0000000
--- a/src/libs/Basalt/init.lua
+++ /dev/null
@@ -1,10 +0,0 @@
-local curDir = fs.getDir(table.pack(...)[2]) or ""
-
-local defaultPath = package.path
-local format = "%s;/%s/?.lua;/%s/?/init.lua"
-package.path = string.format(format, package.path, curDir,curDir)..string.format(format, package.path, curDir.."/libraries",curDir.."/libraries")..string.format(format, package.path, curDir.."/objects",curDir.."/objects")
-
-local Basalt = require("main")
-package.path = defaultPath
-
-return Basalt
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/basaltDraw.lua b/src/libs/Basalt/libraries/basaltDraw.lua
deleted file mode 100644
index 62ce41e..0000000
--- a/src/libs/Basalt/libraries/basaltDraw.lua
+++ /dev/null
@@ -1,209 +0,0 @@
-local tHex = require("tHex")
-local sub,rep = string.sub,string.rep
-
-return function(drawTerm)
- local terminal = drawTerm or term.current()
- local mirrorTerm
- local width, height = terminal.getSize()
- local cacheT = {}
- local cacheBG = {}
- local cacheFG = {}
-
- local _cacheT = {}
- local _cacheBG = {}
- local _cacheFG = {}
-
- local emptySpaceLine
- local emptyColorLines = {}
-
- local function createEmptyLines()
- emptySpaceLine = rep(" ", width)
- for n = 0, 15 do
- local nColor = 2 ^ n
- local sHex = tHex[nColor]
- emptyColorLines[nColor] = rep(sHex, width)
- end
- end
- ----
- createEmptyLines()
-
- local function recreateWindowArray()
- createEmptyLines()
- local emptyText = emptySpaceLine
- local emptyFG = emptyColorLines[colors.white]
- local emptyBG = emptyColorLines[colors.black]
- for currentY = 1, height do
- cacheT[currentY] = sub(cacheT[currentY] == nil and emptyText or cacheT[currentY] .. emptyText:sub(1, width - cacheT[currentY]:len()), 1, width)
- cacheFG[currentY] = sub(cacheFG[currentY] == nil and emptyFG or cacheFG[currentY] .. emptyFG:sub(1, width - cacheFG[currentY]:len()), 1, width)
- cacheBG[currentY] = sub(cacheBG[currentY] == nil and emptyBG or cacheBG[currentY] .. emptyBG:sub(1, width - cacheBG[currentY]:len()), 1, width)
- end
- end
- recreateWindowArray()
-
- local function setText(x, y, text)
- if (y >= 1) and (y <= height) then
- if (x + text:len() > 0) and (x <= width) then
- local oldCache = cacheT[y]
- local newCache
- local nEnd = x + #text - 1
-
- if (x < 1) then
- local startN = 1 - x + 1
- local endN = width - x + 1
- text = sub(text, startN, endN)
- elseif (nEnd > width) then
- local endN = width - x + 1
- text = sub(text, 1, endN)
- end
-
- if (x > 1) then
- local endN = x - 1
- newCache = sub(oldCache, 1, endN) .. text
- else
- newCache = text
- end
- if nEnd < width then
- newCache = newCache .. sub(oldCache, nEnd + 1, width)
- end
- cacheT[y] = newCache
- end
- end
- end
-
- local function setBG(x, y, colorStr)
- if (y >= 1) and (y <= height) then
- if (x + colorStr:len() > 0) and (x <= width) then
- local oldCache = cacheBG[y]
- local newCache
- local nEnd = x + #colorStr - 1
-
- if (x < 1) then
- colorStr = sub(colorStr, 1 - x + 1, width - x + 1)
- elseif (nEnd > width) then
- colorStr = sub(colorStr, 1, width - x + 1)
- end
-
- if (x > 1) then
- newCache = sub(oldCache, 1, x - 1) .. colorStr
- else
- newCache = colorStr
- end
- if nEnd < width then
- newCache = newCache .. sub(oldCache, nEnd + 1, width)
- end
- cacheBG[y] = newCache
- end
- end
- end
-
- local function setFG(x, y, colorStr)
- if (y >= 1) and (y <= height) then
- if (x + colorStr:len() > 0) and (x <= width) then
- local oldCache = cacheFG[y]
- local newCache
- local nEnd = x + #colorStr - 1
-
- if (x < 1) then
- local startN = 1 - x + 1
- local endN = width - x + 1
- colorStr = sub(colorStr, startN, endN)
- elseif (nEnd > width) then
- local endN = width - x + 1
- colorStr = sub(colorStr, 1, endN)
- end
-
- if (x > 1) then
- local endN = x - 1
- newCache = sub(oldCache, 1, endN) .. colorStr
- else
- newCache = colorStr
- end
- if nEnd < width then
- newCache = newCache .. sub(oldCache, nEnd + 1, width)
- end
- cacheFG[y] = newCache
- end
- end
- end
-
- local drawHelper = {
- setSize = function(w, h)
- width, height = w, h
- recreateWindowArray()
- end,
-
- setMirror = function(mirror)
- mirrorTerm = mirror
- end,
- setBG = function(x, y, colorStr)
- setBG(x, y, colorStr)
- end;
-
- setText = function(x, y, text)
- setText(x, y, text)
- end;
-
- setFG = function(x, y, colorStr)
- setFG(x, y, colorStr)
- end;
-
- drawBackgroundBox = function(x, y, width, height, bgCol)
- for n = 1, height do
- setBG(x, y + (n - 1), rep(tHex[bgCol], width))
- end
- end;
- drawForegroundBox = function(x, y, width, height, fgCol)
- for n = 1, height do
- setFG(x, y + (n - 1) ,rep(tHex[fgCol], width))
- end
- end;
- drawTextBox = function(x, y, width, height, symbol)
- for n = 1, height do
- setText(x, y + (n - 1), rep(symbol, width))
- end
- end;
- writeText = function(x, y, text, bgCol, fgCol)
- if(text~=nil)then
- setText(x, y, text)
- if(bgCol~=nil)and(bgCol~=false)then
- setBG(x, y, rep(tHex[bgCol], text:len()))
- end
- if(fgCol~=nil)and(fgCol~=false)then
- setFG(x, y, rep(tHex[fgCol], text:len()))
- end
- end
- end;
-
- update = function()
- local xC, yC = terminal.getCursorPos()
- local isBlinking = false
- if (terminal.getCursorBlink ~= nil) then
- isBlinking = terminal.getCursorBlink()
- end
- terminal.setCursorBlink(false)
- if(mirrorTerm~=nil)then terminal.setCursorBlink(false) end
- for n = 1, height do
- terminal.setCursorPos(1, n)
- terminal.blit(cacheT[n], cacheFG[n], cacheBG[n])
- if(mirrorTerm~=nil)then
- mirrorTerm.setCursorPos(1, n)
- mirrorTerm.blit(cacheT[n], cacheFG[n], cacheBG[n])
- end
- end
- terminal.setBackgroundColor(colors.black)
- terminal.setCursorBlink(isBlinking)
- terminal.setCursorPos(xC, yC)
- if(mirrorTerm~=nil)then
- mirrorTerm.setBackgroundColor(colors.black)
- mirrorTerm.setCursorBlink(isBlinking)
- mirrorTerm.setCursorPos(xC, yC)
- end
-
- end;
-
- setTerm = function(newTerm)
- terminal = newTerm;
- end;
- }
- return drawHelper
-end
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/basaltEvent.lua b/src/libs/Basalt/libraries/basaltEvent.lua
deleted file mode 100644
index 80bcd55..0000000
--- a/src/libs/Basalt/libraries/basaltEvent.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-return function()
- local events = {}
- local index = {}
-
- local event = {
- registerEvent = function(self, _event, func)
- if (events[_event] == nil) then
- events[_event] = {}
- index[_event] = 1
- end
- events[_event][index[_event]] = func
- index[_event] = index[_event] + 1
- return index[_event] - 1
- end;
-
- removeEvent = function(self, _event, index)
- events[_event][index[_event]] = nil
- end;
-
- sendEvent = function(self, _event, ...)
- local returnValue
- if (events[_event] ~= nil) then
- for _, value in pairs(events[_event]) do
- local val = value(...)
- if(val==false)then
- returnValue = val
- end
- end
- end
- return returnValue
- end;
- }
- event.__index = event
- return event
-end
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/basaltLogs.lua b/src/libs/Basalt/libraries/basaltLogs.lua
deleted file mode 100644
index 4edcd5a..0000000
--- a/src/libs/Basalt/libraries/basaltLogs.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-local logDir = ""
-local logFileName = "basaltLog.txt"
-
-local defaultLogType = "Debug"
-
-fs.delete(logDir~="" and logDir.."/"..logFileName or logFileName)
-
-local mt = {
- __call = function(_,text, typ)
- if(text==nil)then return end
- local dirStr = logDir~="" and logDir.."/"..logFileName or logFileName
- local handle = fs.open(dirStr, fs.exists(dirStr) and "a" or "w")
- handle.writeLine("[Basalt]["..(typ and typ or defaultLogType).."]: "..tostring(text))
- handle.close()
- end,
-}
-
-return setmetatable({}, mt)
-
---Work in progress
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/geometricPoints.lua b/src/libs/Basalt/libraries/geometricPoints.lua
deleted file mode 100644
index 01800a2..0000000
--- a/src/libs/Basalt/libraries/geometricPoints.lua
+++ /dev/null
@@ -1,197 +0,0 @@
-local function line(x1,y1,x2,y2)
- local points = {}
- if x1 == x2 and y1 == y2 then return {x=x1,y=x2} end
- local minX = math.min(x1, x2)
- local maxX, minY, maxY
- if minX == x1 then minY,maxX,maxY = y1,x2,y2
- else minY,maxX,maxY = y2,x1,y1 end
- local xDiff,yDiff = maxX - minX,maxY - minY
- if xDiff > math.abs(yDiff) then
- local y = minY
- local dy = yDiff / xDiff
- for x = minX, maxX do
- table.insert(points,{x=x,y=math.floor(y + 0.5)})
- y = y + dy
- end
- else
- local x,dx = minX,xDiff / yDiff
- if maxY >= minY then
- for y = minY, maxY do
- table.insert(points,{x=math.floor(x + 0.5),y=y})
- x = x + dx
- end
- else
- for y = minY, maxY, -1 do
- table.insert(points,{x=math.floor(x + 0.5),y=y})
- x = x - dx
- end
- end
- end
- return points
-end
-
-local function filledCircle(xC, yC, r)
- local points = {}
- for x=-r, r+1 do
- local dy = math.floor(math.sqrt(r*r - x*x))
- for y=-dy, dy+1 do
- table.insert(points, {x=xC+x, y=yC+y})
- end
- end
- return points
-end
-
-local function ellipse(xC, yC, r1, r2, filled)
- local rx,ry = math.ceil(math.floor(r1-0.5)/2),math.ceil(math.floor(r2-0.5)/2)
- local x,y=0,ry
- local d1 = ((ry * ry) - (rx * rx * ry) + (0.25 * rx * rx))
- local dx = 2*ry^2*x
- local dy = 2*rx^2*y
- local points = {}
- while dx < dy do
- table.insert(points,{x=x+xC,y=y+yC})
- table.insert(points,{x=-x+xC,y=y+yC})
- table.insert(points,{x=x+xC,y=-y+yC})
- table.insert(points,{x=-x+xC,y=-y+yC})
- if filled then
- for y=-y+yC+1,y+yC-1 do
- table.insert(points,{x=x+xC,y=y})
- table.insert(points,{x=-x+xC,y=y})
- end
- end
- if d1 < 0 then
- x = x + 1
- dx = dx + 2*ry^2
- d1 = d1 + dx + ry^2
- else
- x,y = x+1,y-1
- dx = dx + 2*ry^2
- dy = dy - 2*rx^2
- d1 = d1 + dx - dy + ry^2
- end
- end
- local d2 = (((ry * ry) * ((x + 0.5) * (x + 0.5))) + ((rx * rx) * ((y - 1) * (y - 1))) - (rx * rx * ry * ry))
- while y >= 0 do
- table.insert(points,{x=x+xC,y=y+yC})
- table.insert(points,{x=-x+xC,y=y+yC})
- table.insert(points,{x=x+xC,y=-y+yC})
- table.insert(points,{x=-x+xC,y=-y+yC})
- if filled then
- for y=-y+yC,y+yC do
- table.insert(points,{x=x+xC,y=y})
- table.insert(points,{x=-x+xC,y=y})
- end
- end
- if d2 > 0 then
- y = y - 1
- dy = dy - 2*rx^2
- d2 = d2 + rx^2 - dy
- else
- y = y - 1
- x = x + 1
- dy = dy - 2*rx^2
- dx = dx + 2*ry^2
- d2 = d2 + dx - dy + rx^2
- end
- end
- return points
-end
-
-local function circle(xC, yC, r, filled)
- return ellipse(xC, yC, r, r, filled)
-end
-
-return {
-circle = function(x, y, radius, filled)
- return circle(x, y, radius, filled)
-end,
-
-rectangle = function(x1, y1, x2, y2, filled)
- local points = {}
- if(filled)then
- for y=y1,y2 do
- for x=x1,x2 do
- table.insert(points, {x=x,y=y})
- end
- end
- else
- for y=y1,y2 do
- for x=x1,x2 do
- if(x==x1)or(x==x2)or(y==y1)or(y==y2)then
- table.insert(points, {x=x,y=y})
- end
- end
- end
- end
- return points
-end,
-
-triangle = function(x1, y1, x2, y2, x3, y3, filled)
- local function drawFlatTopTriangle(points,x1,y1,x2,y2,x3,y3)
- local m1 = (x3 - x1) / (y3 - y1)
- local m2 = (x3 - x2) / (y3 - y2)
- local yStart = math.ceil(y1 - 0.5)
- local yEnd = math.ceil(y3 - 0.5)-1
- for y = yStart, yEnd do
- local px1 = m1 * (y + 0.5 - y1) + x1
- local px2 = m2 * (y + 0.5 - y2) + x2
- local xStart = math.ceil(px1 - 0.5)
- local xEnd = math.ceil(px2 - 0.5)
- for x=xStart,xEnd do
- table.insert(points,{x=x,y=y})
- end
- end
- end
-
- local function drawFlatBottomTriangle(points,x1,y1,x2,y2,x3,y3)
- local m1 = (x2 - x1) / (y2 - y1)
- local m2 = (x3 - x1) / (y3 - y1)
- local yStart = math.ceil(y1-0.5)
- local yEnd = math.ceil(y3-0.5)-1
- for y = yStart, yEnd do
- local px1 = m1 * (y + 0.5 - y1) + x1
- local px2 = m2 * (y + 0.5 - y1) + x1
- local xStart = math.ceil(px1 - 0.5)
- local xEnd = math.ceil(px2 - 0.5)
- for x=xStart,xEnd do
- table.insert(points,{x=x,y=y})
- end
- end
- end
- local points = {}
- if(filled)then
- if y2 < y1 then x1,y1,x2,y2 = x2,y2,x1,y1 end
- if y3 < y2 then x2,y2,x3,y3 = x3,y3,x2,y2 end
- if y2 < y2 then x1,y1,x2,y2 = x2,y2,x1,y1 end
- if y1 == y2 then
- if x2 < x1 then x1,y1,x2,y2 = x2,y2,x1,y1 end
- drawFlatTopTriangle(points,x1,y1,x2,y2,x3,y3)
- elseif y2 == y3 then
- if x3 < x2 then x3,y3,x2,y2 = x2,y2,x3,y3 end
- drawFlatBottomTriangle(points,x1,y1,x2,y2,x3,y3)
- else
- local alphaSplit = (y2-y1)/(y3-y1)
- local x = x1 + ((x3 - x1) * alphaSplit)
- local y = y1 + ((y3 - y1) * alphaSplit)
- if x2 < x then
- drawFlatBottomTriangle(points,x1,y1,x2,y2,x, y)
- drawFlatTopTriangle(points,x2,y2,x,y,x3,y3)
- else
- drawFlatBottomTriangle(points,x1,y1,x,y,x1,y1)
- drawFlatTopTriangle(points,x,y,x2,y2,x3,y3)
- end
- end
- else
- points = line(x1,y1,x2,y2)
- for k,v in pairs(line(x2,y2,x3,y3))do table.insert(points, v) end
- for k,v in pairs(line(x3,y3,x1,y1))do table.insert(points, v) end
- end
- return points
-end,
-
-line = line,
-
-ellipse = function(xCenter, yCenter, radius1, radius2, filled)
- return ellipse(xCenter, yCenter, radius1, radius2, filled)
-end
-}
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/layout.lua b/src/libs/Basalt/libraries/layout.lua
deleted file mode 100644
index ee29437..0000000
--- a/src/libs/Basalt/libraries/layout.lua
+++ /dev/null
@@ -1,147 +0,0 @@
-local function newNode(name)
- local node = {}
- node.___value = nil
- node.___name = name
- node.___children = {}
- node.___props = {}
-
- function node:value() return self.___value end
- function node:setValue(val) self.___value = val end
- function node:name() return self.___name end
- function node:setName(name) self.___name = name end
- function node:children() return self.___children end
- function node:numChildren() return #self.___children end
- function node:addChild(child)
- if self[child:name()] ~= nil then
- if type(self[child:name()].name) == "function" then
- local tempTable = {}
- table.insert(tempTable, self[child:name()])
- self[child:name()] = tempTable
- end
- table.insert(self[child:name()], child)
- else
- self[child:name()] = child
- end
- table.insert(self.___children, child)
- end
-
- function node:properties() return self.___props end
- function node:numProperties() return #self.___props end
- function node:addProperty(name, value)
- local lName = "@" .. name
- if self[lName] ~= nil then
- if type(self[lName]) == "string" then
- local tempTable = {}
- table.insert(tempTable, self[lName])
- self[lName] = tempTable
- end
- table.insert(self[lName], value)
- else
- self[lName] = value
- end
- table.insert(self.___props, { name = name, value = self[name] })
- end
-
- return node
-end
-
-local XmlParser = {};
-
-function XmlParser:ToXmlString(value)
- value = string.gsub(value, "&", "&"); -- '&' -> "&"
- value = string.gsub(value, "<", "<"); -- '<' -> "<"
- value = string.gsub(value, ">", ">"); -- '>' -> ">"
- value = string.gsub(value, "\"", """); -- '"' -> """
- value = string.gsub(value, "([^%w%&%;%p%\t% ])",
- function(c)
- return string.format("%X;", string.byte(c))
- end);
- return value;
-end
-
-function XmlParser:FromXmlString(value)
- value = string.gsub(value, "([%x]+)%;",
- function(h)
- return string.char(tonumber(h, 16))
- end);
- value = string.gsub(value, "([0-9]+)%;",
- function(h)
- return string.char(tonumber(h, 10))
- end);
- value = string.gsub(value, """, "\"");
- value = string.gsub(value, "'", "'");
- value = string.gsub(value, ">", ">");
- value = string.gsub(value, "<", "<");
- value = string.gsub(value, "&", "&");
- return value;
-end
-
-function XmlParser:ParseArgs(node, s)
- string.gsub(s, "(%w+)=([\"'])(.-)%2", function(w, _, a)
- node:addProperty(w, self:FromXmlString(a))
- end)
-end
-
-function XmlParser:ParseXmlText(xmlText)
- local stack = {}
- local top = newNode()
- table.insert(stack, top)
- local ni, c, label, xarg, empty
- local i, j = 1, 1
- while true do
- ni, j, c, label, xarg, empty = string.find(xmlText, "<(%/?)([%w_:]+)(.-)(%/?)>", i)
- if not ni then break end
- local text = string.sub(xmlText, i, ni - 1);
- if not string.find(text, "^%s*$") then
- local lVal = (top:value() or "") .. self:FromXmlString(text)
- stack[#stack]:setValue(lVal)
- end
- if empty == "/" then -- empty element tag
- local lNode = newNode(label)
- self:ParseArgs(lNode, xarg)
- top:addChild(lNode)
- elseif c == "" then -- start tag
- local lNode = newNode(label)
- self:ParseArgs(lNode, xarg)
- table.insert(stack, lNode)
- top = lNode
- else -- end tag
- local toclose = table.remove(stack) -- remove top
-
- top = stack[#stack]
- if #stack < 1 then
- error("XmlParser: nothing to close with " .. label)
- end
- if toclose:name() ~= label then
- error("XmlParser: trying to close " .. toclose.name .. " with " .. label)
- end
- top:addChild(toclose)
- end
- i = j + 1
- end
- local text = string.sub(xmlText, i);
- if #stack > 1 then
- error("XmlParser: unclosed " .. stack[#stack]:name())
- end
- return top
-end
-
-function XmlParser:loadFile(xmlFilename, base)
- if not base then
- base = system.ResourceDirectory
- end
-
- local path = system.pathForFile(xmlFilename, base)
- local hFile, err = io.open(path, "r");
-
- if hFile and not err then
- local xmlText = hFile:read("*a"); -- read file content
- io.close(hFile);
- return self:ParseXmlText(xmlText), nil;
- else
- print(err)
- return nil
- end
-end
-
-return XmlParser
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/miniBDF.lua b/src/libs/Basalt/libraries/miniBDF.lua
deleted file mode 100644
index 6e5ddb0..0000000
--- a/src/libs/Basalt/libraries/miniBDF.lua
+++ /dev/null
@@ -1,304 +0,0 @@
----Converts a given table to a blit char.
----@param str string Something like: "100110" for \153
----@return string sChar Matching counter part
----@return boolean bReversed Swaped text & background color?
-local function toBlit(str)
- if type(str) ~= "string" or #str < 6 then
- str = "000000"
- elseif str:sub(1,1) == '#' then
- return str:sub(2,2), false
- end
- local t = {}
- for i=1,6 do
- t[#t+1] = tonumber(str:sub(i,i)) or 0
- end
-
- if t[6]==1 then
- for i=1,5 do
- t[i] = 1-t[i]
- end end
- local n = 128
- for i=0,4 do
- n = n+t[i+1]*2^i
- end
-
- return string.char(n), (t[6] == 1)
-end
-
----Converts a given char to a table,
----representing pixels in the current font.
----@param font table The font, generated with bdf.loadBDF(...)
----@param char string The char (e.g. "f")
----@return table char The char in the current font, as table
-local function drawChar(font, char)
- local char = font.bitmap[char:byte()]
- -- Return empty
- if not char then
- if not font.bitmap[63] then
- local width,height = font.width,font.height
- local tmp = (' '):rep(width)
- local char = {}
- for y=1,height do
- char[#char+1] = tmp
- end
- return char
- else
- char = font.bitmap[63]
- end
- end
-
- -- Get bitmap
- local result = {}
- local j=0
- for i=#char,1,-1 do
- result[font.width-j-char.bound.offy-font.offy] = char[i]
- j=j+1
- end
- -- Fill gaps
- for i=1,font.height do
- if not result[i] then
- result[i] = ('0'):rep(font.width)
- else
- if char.bound.offx > 0 then
- result[i] = ('0'):rep(char.bound.offx)..result[i]
- end
- if #result[i] < font.width then
- result[i] =result[i]..('0'):rep(font.width-#result[i])
- end
- end
- end
-
- return result
-end
-
----Same as drawChar but with strings.
----@param font The font, generated with bdf.loadBDF(...)
----@param str string The string (e.g. "Hello")
----@return table str The string in the current font, as table
-local function drawString(font, str)
- local string = {}
- for x=1,#str do
- local char = font:drawChar(str:sub(x))
- for y=1,#char do
- if not string[y] then string[y] = "" end
- string[y] = string[y]..char[y]
- end
- end
- return string
-end
-
-local function needsSpace(len,expected)
- local add = 0
- while math.floor((len+add)/expected) ~= ((len+add)/expected) do
- add = add+1
- end
- return add
-end
-
-local blit = {[1]='0',[2]='1',[4]='2',[8]='3',[16]='4',[32]='5',[64]='6',[128]='7',[256]='8',[512]='9',[1024]='a',[2048]='b',[4096]='c',[8192]='d',[16384]='e',[32768]='f' }
----Converts a bitmap table into a one represented by box chars.
----@param str table The bitmap (could be via font:drawChar("..."))
----@param bg number The Background color
----@param fg number The Background color
----@return table blits The result
-local function compress(str, bg,fg)
- local addX = needsSpace(#str[1],2)
- local addY = needsSpace(#str,3)
- if addX > 0 then
- for i=1,#str do
- str[i] = str[i]..('0'):rep(addX)
- end
- end
- if addY > 0 then
- for i=1,addY do
- str[#str+1] = ('0'):rep(#str[1])
- end
- end
-
- local blits = {
- ch={},
- bg={},
- fg={}
- }
- for y=1,#str/3 do
- blits.ch[y] = ""
- blits.bg[y] = ""
- blits.fg[y] = ""
- end
-
- for x=1,#str[1]/2 do
- for y=1,#str/3 do
- local char,invert = toBlit(
- str[y*3-2]:sub(x*2-1,x*2)..
- str[y*3-1]:sub(x*2-1,x*2)..
- str[y*3-0]:sub(x*2-1,x*2)
- )
- blits.ch[y] = blits.ch[y]..char
- local c1,c2 = blit[bg],blit[fg]
- if invert then
- c2,c1 = blit[bg],blit[fg]
- end
- blits.bg[y] = blits.bg[y]..c1
- blits.fg[y] = blits.fg[y]..c2
- end
- end
- return blits
-end
-
-
-local data = {
- FONT = function(font,line)
- font.name = line
- end,
- FONTBOUNDINGBOX = function(font,line)
- local type={"width","height","offx","offy"}
- local i=1
- for word in string.gmatch(line, '([^ ]+)') do
- if i > #type then return end
- font[type[i]] = tonumber(word) or 0
- i=i+1
- end
- end,
- CHARSET_REGISTRY = function(font,line)
- if line:find("ISO") and line:find("8859") then
- font.validCharReg = font.validCharReg+1
- end
- end,
- CHARSET_ENCODING = function(font,line)
- if line:find("\"1\"") then
- font.validCharReg = font.validCharReg+1
- end
- end,
- CHARS = function(font,line)
- local num = tonumber(line) or 0
- if num == 256 then
- font.validCharReg = font.validCharReg+1
- end
- end,
- STARTCHAR = function(font,line)
- font._CUR_CHAR = {name=line}
- end,
- ENCODING = function(font,line)
- if not font._CUR_CHAR then return end
- font._CUR_CHAR.byte = tonumber(line) or 0
- end,
- BBX = function(font, line)
- local i=1
- local b = {"width","height","offx","offy"}
- font._CUR_CHAR.bound = {}
- for word in string.gmatch(line, '([^ ]+)') do
- if i > #b then return end
- font._CUR_CHAR.bound[b[i]] = tonumber(word) or 0
- i=i+1
- end
- end,
- BITMAP = function(font,_)
- font.isBitmap = true
- end
-}
-
----Parses a .BDF font file into a in lua readable table.
----@param path string The path to the .BDF file
----@return table font The result
-local function loadBDF(path)
- if not (fs.exists(path) and not fs.isDir(path)) then
- return printError("Could not load: \'"..path.."\'!")
- end
-
- local f = fs.open(path, 'r')
- local font = {bitmap={},validCharReg=0,isBitmap=false}
-
- local line = f.readLine()
- repeat
- if font.isBitmap then
- if line:find("ENDCHAR") then
- -- Finishing
- font.isBitmap = false
- local byte = font._CUR_CHAR.byte
- font._CUR_CHAR.byte = nil
- font.bitmap[byte] = {}
- for k,v in pairs(font._CUR_CHAR) do
- font.bitmap[byte][k] = v
- end
- font._CUR_CHAR = nil
- else
- local num = tonumber("0x"..line)
- if not num then return end
-
- local function ffs(value)
- if value == 0 then return 0 end
- local pos = 0;
- while bit32.band(value, 1) == 0 do
- value = bit32.rshift(value, 1);
- pos = pos + 1
- end
- return pos
- end
-
- local l = ""
- local w = math.ceil(math.floor(math.log(num) / math.log(2)) / 8) * 8
- for i = ffs(num) or 0, w do
- l = l..bit32.band(bit32.rshift(num, i-1), 1)
- end
- l = l:reverse()
- local w = font._CUR_CHAR.bound.width
- if #l > w then
- l = l:sub(1,w)
- elseif #l < w then
- l = l..('0'):rep(w-#l)
- end
-
- font._CUR_CHAR[#font._CUR_CHAR+1] = l
- end
- else
- local label = line:match('([^ ]+)')
- if data[label] then
- data[label](font, line:sub(#label+2))
- end
- end
- line = f.readLine()
- until line == nil
-
- f.close()
- font.isBitmap = nil
- font.validCharReg = (font.validCharReg == 3)
- font.drawChar = drawChar
- font.drawString = drawString
- return font
-end
-
----Checks for errors a font may have. Should return 0.
----The bigger the results number, the more errors it has.
----@param font table The font that will be checked.
----@return number errors The amount of errors the font has.
----@return table messages The error messages
-local function checkFont(font)
- local msg = {}
- local errorCounter = 0
- if type(font.name) ~= "string" then
- errorCounter = errorCounter+1
- table.insert(msg,"Font has no name.")
- elseif type(font.width) ~= "number" then
- errorCounter = errorCounter+1
- table.insert(msg,"Font has no global width.")
- elseif type(font.height) ~= "number" then
- errorCounter = errorCounter+1
- table.insert(msg,"Font has no global height.")
- elseif not font.validCharReg then
- errorCounter = errorCounter+1
- table.insert(msg,"Font uses not supported format.")
- elseif type(font.bitmap) ~= "table" then
- errorCounter = errorCounter+1
- table.insert(msg,"Font has no bitmaps (nothing to render)")
- elseif #font.bitmap ~= 255 then
- errorCounter = errorCounter+1
- table.insert(msg,"Font may have missing chars.")
- end
- return errorCounter,msg
-end
-
-return {
- loadBDF = loadBDF,
- checkFont = checkFont,
- compress = compress
-}
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/process.lua b/src/libs/Basalt/libraries/process.lua
deleted file mode 100644
index 8a7248e..0000000
--- a/src/libs/Basalt/libraries/process.lua
+++ /dev/null
@@ -1,63 +0,0 @@
-local processes = {}
-local process = {}
-local processId = 0
-
-function process:new(path, window, ...)
- local args = {...}
- local newP = setmetatable({ path = path }, { __index = self })
- newP.window = window
- newP.processId = processId
- if(type(path)=="string")then
- newP.coroutine = coroutine.create(function()
- shell.execute(path, table.unpack(args))
- end)
- elseif(type(path)=="function")then
- newP.coroutine = coroutine.create(function()
- path(table.unpack(args))
- end)
- else
- return
- end
- processes[processId] = newP
- processId = processId + 1
- return newP
-end
-
-function process:resume(event, ...)
- term.redirect(self.window)
- if(self.filter~=nil)then
- if(event~=self.filter)then return end
- self.filter=nil
- end
- local ok, result = coroutine.resume(self.coroutine, event, ...)
- if ok then
- self.filter = result
- else
- error(result)
- end
-end
-
-function process:isDead()
- if (self.coroutine ~= nil) then
- if (coroutine.status(self.coroutine) == "dead") then
- table.remove(processes, self.processId)
- return true
- end
- else
- return true
- end
- return false
-end
-
-function process:getStatus()
- if (self.coroutine ~= nil) then
- return coroutine.status(self.coroutine)
- end
- return nil
-end
-
-function process:start()
- coroutine.resume(self.coroutine)
-end
-
-return process
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/tHex.lua b/src/libs/Basalt/libraries/tHex.lua
deleted file mode 100644
index bd070ca..0000000
--- a/src/libs/Basalt/libraries/tHex.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-return { -- copy paste is a very important feature
- [colors.white] = "0",
- [colors.orange] = "1",
- [colors.magenta] = "2",
- [colors.lightBlue] = "3",
- [colors.yellow] = "4",
- [colors.lime] = "5",
- [colors.pink] = "6",
- [colors.gray] = "7",
- [colors.lightGray] = "8",
- [colors.cyan] = "9",
- [colors.purple] = "a",
- [colors.blue] = "b",
- [colors.brown] = "c",
- [colors.green] = "d",
- [colors.red] = "e",
- [colors.black] = "f",
-}
\ No newline at end of file
diff --git a/src/libs/Basalt/libraries/utils.lua b/src/libs/Basalt/libraries/utils.lua
deleted file mode 100644
index f9844ce..0000000
--- a/src/libs/Basalt/libraries/utils.lua
+++ /dev/null
@@ -1,120 +0,0 @@
-local splitString = function(str, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for v in string.gmatch(str, "([^"..sep.."]+)") do
- table.insert(t, v)
- end
- return t
-end
-
-return {
-getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
- text = string.sub(text, 1, width)
- local offset = width - string.len(text)
- if (textAlign == "right") then
- text = string.rep(replaceChar or " ", offset) .. text
- elseif (textAlign == "center") then
- text = string.rep(replaceChar or " ", math.floor(offset / 2)) .. text .. string.rep(replaceChar or " ", math.floor(offset / 2))
- text = text .. (string.len(text) < width and (replaceChar or " ") or "")
- else
- text = text .. string.rep(replaceChar or " ", offset)
- end
- return text
-end,
-
-getTextVerticalAlign = function(h, textAlign)
- local offset = 0
- if (textAlign == "center") then
- offset = math.ceil(h / 2)
- if (offset < 1) then
- offset = 1
- end
- end
- if (textAlign == "bottom") then
- offset = h
- end
- if(offset<1)then offset=1 end
- return offset
-end,
-
-rpairs = function(t)
- return function(t, i)
- i = i - 1
- if i ~= 0 then
- return i, t[i]
- end
- end, t, #t + 1
-end,
-
-tableCount = function(t)
- local n = 0
- if(t~=nil)then
- for k,v in pairs(t)do
- n = n + 1
- end
- end
- return n
-end,
-
-splitString = splitString,
-
-createText = function(str, width)
- local uniqueLines = splitString(str, "\n")
- local lines = {}
- for k,v in pairs(uniqueLines)do
- local line = ""
- local words = splitString(v, " ")
- for a,b in pairs(words)do
- if(#line+#b <= width)then
- line = line=="" and b or line.." "..b
- if(a==#words)then table.insert(lines, line) end
- else
- table.insert(lines, line)
- line = b:sub(1,width)
- if(a==#words)then table.insert(lines, line) end
- end
- end
- end
- return lines
-end,
-
-getValueFromXML = function(name, tab)
- local var
- if(type(tab)~="table")then return end
- if(tab[name]~=nil)then
- if(type(tab[name])=="table")then
- if(tab[name].value~=nil)then
- var = tab[name]:value()
- end
- end
- end
- if(var==nil)then var = tab["@"..name] end
-
- if(var=="true")then
- var = true
- elseif(var=="false")then
- var = false
- elseif(tonumber(var)~=nil)then
- var = tonumber(var)
- end
- return var
-end,
-
-numberFromString = function(str)
- return load("return " .. str)()
-end,
-
-uuid = function()
- local random = math.random
- local function uuid()
- local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
- return string.gsub(template, '[xy]', function (c)
- local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
- return string.format('%x', v)
- end)
- end
- return uuid()
-end,
-}
\ No newline at end of file
diff --git a/src/libs/Basalt/loadObjects.lua b/src/libs/Basalt/loadObjects.lua
deleted file mode 100644
index bb600dd..0000000
--- a/src/libs/Basalt/loadObjects.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-local _OBJECTS = {}
-if(packaged)then
- for k,v in pairs(getProject("objects"))do
- _OBJECTS[k] = v()
- end
- return _OBJECTS
-end
-
-local args = table.pack(...)
-local dir = fs.getDir(args[2] or "Basalt")
-if(dir==nil)then
- error("Unable to find directory "..args[2].." please report this bug to our discord.")
-end
-
-for _,v in pairs(fs.list(fs.combine(dir, "objects")))do
- if(v~="example.lua")then
- local name = v:gsub(".lua", "")
- _OBJECTS[name] = require(name)
- end
-end
-return _OBJECTS
\ No newline at end of file
diff --git a/src/libs/Basalt/main.lua b/src/libs/Basalt/main.lua
deleted file mode 100644
index 28fc5b3..0000000
--- a/src/libs/Basalt/main.lua
+++ /dev/null
@@ -1,357 +0,0 @@
-local basaltEvent = require("basaltEvent")()
-local Frame = require("Frame")
-local theme = require("theme")
-local utils = require("utils")
-local log = require("basaltLogs")
-local uuid = utils.uuid
-local createText = utils.createText
-
-
-local baseTerm = term.current()
-local version = "1.6.1"
-local debugger = true
-
-local projectDirectory = fs.getDir(table.pack(...)[2] or "")
-
-local activeKey, frames, monFrames, variables, schedules = {}, {}, {}, {}, {}
-local mainFrame, activeFrame, focusedObject, updaterActive
-
-local basalt = {}
-
-if not term.isColor or not term.isColor() then
- error('Basalt requires an advanced (golden) computer to run.', 0)
-end
-
-local function stop()
- updaterActive = false
- baseTerm.clear()
- baseTerm.setCursorPos(1, 1)
-end
-
-local setVariable = function(name, var)
- variables[name] = var
-end
-
-local getVariable = function(name)
- return variables[name]
-end
-
-local setTheme = function(_theme)
- theme = _theme
-end
-
-local getTheme = function(name)
- return theme[name]
-end
-
-local bInstance = {
- getMainFrame = function()
- return mainFrame
- end,
-
- setVariable = setVariable,
- getVariable = getVariable,
- getTheme = getTheme,
-
- setMainFrame = function(mFrame)
- mainFrame = mFrame
- end,
-
- getActiveFrame = function()
- return activeFrame
- end,
-
- setActiveFrame = function(aFrame)
- activeFrame = aFrame
- end,
-
- getFocusedObject = function()
- return focusedObject
- end,
-
- setFocusedObject = function(focused)
- focusedObject = focused
- end,
-
- getMonitorFrame = function(name)
- return monFrames[name]
- end,
-
- setMonitorFrame = function(name, frame)
- if(mainFrame == frame)then mainFrame = nil end
- monFrames[name] = frame
- end,
-
- getBaseTerm = function()
- return baseTerm
- end,
-
- stop = stop,
- newFrame = Frame,
-
- getDirectory = function()
- return projectDirectory
- end
-}
-
-local basaltError = function(errMsg)
- baseTerm.clear()
- baseTerm.setBackgroundColor(colors.black)
- baseTerm.setTextColor(colors.red)
- local w,h = baseTerm.getSize()
- if(basalt.logging)then
- log(errMsg, "Error")
- end
-
- local text = createText("Basalt error: "..errMsg, w)
- local yPos = 1
- for k,v in pairs(text)do
- baseTerm.setCursorPos(1,yPos)
- baseTerm.write(v)
- yPos = yPos + 1
- end
- baseTerm.setCursorPos(1,yPos+1)
- updaterActive = false
-end
-
-local function handleSchedules(event, p1, p2, p3, p4)
- if(#schedules>0)then
- local finished = {}
- for n=1,#schedules do
- if(schedules[n]~=nil)then
- if (coroutine.status(schedules[n]) == "suspended")then
- local ok, result = coroutine.resume(schedules[n], event, p1, p2, p3, p4)
- if not(ok)then
- basaltError(result)
- end
- else
- table.insert(finished, n)
- end
- end
- end
- for n=1,#finished do
- table.remove(schedules, finished[n]-(n-1))
- end
- end
-end
-
-local function drawFrames()
- if(updaterActive==false)then return end
- if(mainFrame~=nil)then
- mainFrame:draw()
- mainFrame:updateTerm()
- end
- for _,v in pairs(monFrames)do
- v:draw()
- v:updateTerm()
- end
-end
-
-local function basaltUpdateEvent(event, p1, p2, p3, p4)
- if(basaltEvent:sendEvent("basaltEventCycle", event, p1, p2, p3, p4)==false)then return end
- if(mainFrame~=nil)then
- if (event == "mouse_click") then
- mainFrame:mouseHandler(p1, p2, p3, false)
- activeFrame = mainFrame
- elseif (event == "mouse_drag") then
- mainFrame:dragHandler(p1, p2, p3, p4)
- activeFrame = mainFrame
- elseif (event == "mouse_up") then
- mainFrame:mouseUpHandler(p1, p2, p3, p4)
- activeFrame = mainFrame
- elseif (event == "mouse_scroll") then
- mainFrame:scrollHandler(p1, p2, p3, p4)
- activeFrame = mainFrame
- end
- end
- if(event == "monitor_touch") then
- if(monFrames[p1]~=nil)then
- monFrames[p1]:mouseHandler(1, p2, p3, true)
- activeFrame = monFrames[p1]
- end
- end
-
- if(event == "char")then
- if(activeFrame~=nil)then
- activeFrame:charHandler(p1)
- end
- end
- if(event == "key_up")then
- if(activeFrame~=nil)then
- activeFrame:keyUpHandler(p1)
- end
- activeKey[p1] = false
- end
- if(event == "key")then
- if(activeFrame~=nil)then
- activeFrame:keyHandler(p1, p2)
- end
- activeKey[p1] = true
- end
- if(event == "terminate")then
- if(activeFrame~=nil)then
- activeFrame:eventHandler(event)
- if(updaterActive==false)then return end
- end
- end
- if(event~="mouse_click")and(event~="mouse_up")and(event~="mouse_scroll")and(event~="mouse_drag")and(event~="key")and(event~="key_up")and(event~="char")and(event~="terminate")then
- for k, v in pairs(frames) do
- v:eventHandler(event, p1, p2, p3, p4)
- end
- end
- handleSchedules(event, p1, p2, p3, p4)
- drawFrames()
-end
-
-basalt = {
- logging = false,
- setTheme = setTheme,
- getTheme = getTheme,
- drawFrames = drawFrames,
- getVersion = function()
- return version
- end,
-
- setVariable = setVariable,
- getVariable = getVariable,
-
- setBaseTerm = function(_baseTerm)
- baseTerm = _baseTerm
- end,
-
- log = function(...)
- log(...)
- end,
-
- autoUpdate = function(isActive)
- updaterActive = isActive
- if(isActive==nil)then updaterActive = true end
- local function f()
- drawFrames()
- while updaterActive do
- basaltUpdateEvent(os.pullEventRaw())
- end
- end
- local ok, err = xpcall(f, debug.traceback)
- if not(ok)then
- basaltError(err)
- return
- end
- end,
-
- update = function(event, p1, p2, p3, p4)
- if (event ~= nil) then
- local ok, err = xpcall(basaltUpdateEvent, debug.traceback, event, p1, p2, p3, p4)
- if not(ok)then
- basaltError(err)
- return
- end
- end
- end,
-
- stop = stop,
- stopUpdate = stop,
-
- isKeyDown = function(key)
- if(activeKey[key]==nil)then return false end
- return activeKey[key];
- end,
-
- getFrame = function(name)
- for _, value in pairs(frames) do
- if (value.name == name) then
- return value
- end
- end
- end,
-
- getActiveFrame = function()
- return activeFrame
- end,
-
- setActiveFrame = function(frame)
- if (frame:getType() == "Frame") then
- activeFrame = frame
- return true
- end
- return false
- end,
-
- onEvent = function(...)
- for _,v in pairs(table.pack(...))do
- if(type(v)=="function")then
- basaltEvent:registerEvent("basaltEventCycle", v)
- end
- end
- end,
-
- schedule = function(f)
- assert(f~="function", "Schedule needs a function in order to work!")
- return function(...)
- local co = coroutine.create(f)
- local ok, result = coroutine.resume(co, ...)
- if(ok)then
- table.insert(schedules, co)
- else
- basaltError(result)
- end
- end
- end,
-
- createFrame = function(name)
- name = name or uuid()
- for _, v in pairs(frames) do
- if (v.name == name) then
- return nil
- end
- end
- local newFrame = Frame(name,nil,nil,bInstance)
- newFrame:init()
- table.insert(frames, newFrame)
- if(mainFrame==nil)and(newFrame:getName()~="basaltDebuggingFrame")then
- newFrame:show()
- end
- return newFrame
- end,
-
- removeFrame = function(name)
- frames[name] = nil
- end,
-
- setProjectDir = function(dir)
- projectDirectory = dir
- end,
-
- debug = function(...)
- local args = { ... }
- if(mainFrame==nil)then print(...) return end
- if (mainFrame.name ~= "basaltDebuggingFrame") then
- if (mainFrame ~= basalt.debugFrame) then
- basalt.debugLabel:setParent(mainFrame)
- end
- end
- local str = ""
- for key, value in pairs(args) do
- str = str .. tostring(value) .. (#args ~= key and ", " or "")
- end
- basalt.debugLabel:setText("[Debug] " .. str)
- for k,v in pairs(createText(str, basalt.debugList:getWidth()))do
- basalt.debugList:addItem(v)
- end
- if (basalt.debugList:getItemCount() > 50) then
- basalt.debugList:removeItem(1)
- end
- basalt.debugList:setValue(basalt.debugList:getItem(basalt.debugList:getItemCount()))
- if(basalt.debugList.getItemCount() > basalt.debugList:getHeight())then
- basalt.debugList:setOffset(basalt.debugList:getItemCount() - basalt.debugList:getHeight())
- end
- basalt.debugLabel:show()
- end,
-}
-
-basalt.debugFrame = basalt.createFrame("basaltDebuggingFrame"):showBar():setBackground(colors.lightGray):setBar("Debug", colors.black, colors.gray)
-basalt.debugFrame:addButton("back"):setAnchor("topRight"):setSize(1, 1):setText("\22"):onClick(function() if(basalt.oldFrame~=nil)then basalt.oldFrame:show() end end):setBackground(colors.red):show()
-basalt.debugList = basalt.debugFrame:addList("debugList"):setSize("parent.w - 2", "parent.h - 3"):setPosition(2, 3):setScrollable(true):show()
-basalt.debugLabel = basalt.debugFrame:addLabel("debugLabel"):onClick(function() basalt.oldFrame = mainFrame basalt.debugFrame:show() end):setBackground(colors.black):setForeground(colors.white):setAnchor("bottomLeft"):ignoreOffset():setZIndex(20):show()
-
-return basalt
diff --git a/src/libs/Basalt/objects/Animation.lua b/src/libs/Basalt/objects/Animation.lua
deleted file mode 100644
index 48d9d97..0000000
--- a/src/libs/Basalt/objects/Animation.lua
+++ /dev/null
@@ -1,471 +0,0 @@
-local xmlValue = require("utils").getValueFromXML
-local basaltEvent = require("basaltEvent")
-
-local floor,sin,cos,pi = math.floor,math.sin,math.cos,math.pi
-
-local lerp = function(s, e, pct)
- return s + (e - s) * pct
-end
-
-local linear = function (t)
- return t
-end
-
-local flip = function (t)
- return 1 - t
-end
-
-local easeIn = function (t)
- return t * t * t
-end
-
-local easeOut = function(t)
- return flip(easeIn(flip(t)))
-end
-
-local easeInOut = function(t)
- return lerp(easeIn(t), easeOut(t), t)
-end
-
-local easeOutSine = function(t)
- return sin((t * pi) / 2);
-end
-
-local easeInSine = function(t)
- return flip(cos((t * pi) / 2))
-end
-
-local easeInOutSine = function(t)
- return -(cos(pi * x) - 1) / 2
-end
-
-local lerp = {
- linear = linear,
- lerp = lerp,
- flip=flip,
- easeIn=easeIn,
- easeOut=easeOut,
- easeInOut=easeInOut,
- easeOutSine = easeOutSine,
- easeInSine = easeInSine,
- easeInOutSine = easeInOutSine,
-}
-
-local activeAnimations = {}
-
-return function(name)
- local object = {}
- local objectType = "Animation"
-
- local timerObj
-
- local animations = {}
- local animationTime = 0
- local animationActive = false
- local index = 1
- local infinitePlay = false
-
- local eventSystem = basaltEvent()
-
- local nextWaitTimer = 0
- local lastFunc
- local loop=false
- local autoDestroy = false
- local mode = "easeOut"
-
- local _OBJ
-
- local function call(tab)
- for k,v in pairs(tab)do
- v(object, animations[index].t, index)
- end
- end
-
- local function onPlay(self)
- if(index==1)then self:animationStartHandler() end
- if (animations[index] ~= nil) then
- call(animations[index].f)
- animationTime = animations[index].t
- end
- index = index + 1
- if(animations[index]==nil)then
- if(infinitePlay)then
- index = 1
- animationTime = 0
- else
- self:animationDoneHandler()
- return
- end
- end
- if (animations[index].t > 0) then
- timerObj = os.startTimer(animations[index].t - animationTime)
- else
- onPlay(self)
- end
- end
-
- local function addAnimationPart(time, f)
- for n=1,#animations do
- if(animations[n].t==time)then
- table.insert(animations[n].f, f)
- return
- end
- end
- for n=1,#animations do
- if(animations[n].t>time)then
- if(animations[n-1]~=nil)then
- if(animations[n-1].t