aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/GuiLua.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-20 16:21:16 +1000
committerDavid Walter Seikel2014-03-20 16:21:16 +1000
commitd7d879959b5402a8cae836b8c8285f38d9414f6e (patch)
treea276bc1c63ecbdb823051ffb1e5c874a18249d28 /ClientHamr/GuiLua/GuiLua.c
parentRejig stubs a little. (diff)
downloadSledjHamr-d7d879959b5402a8cae836b8c8285f38d9414f6e.zip
SledjHamr-d7d879959b5402a8cae836b8c8285f38d9414f6e.tar.gz
SledjHamr-d7d879959b5402a8cae836b8c8285f38d9414f6e.tar.bz2
SledjHamr-d7d879959b5402a8cae836b8c8285f38d9414f6e.tar.xz
First hack at Thing.
Diffstat (limited to 'ClientHamr/GuiLua/GuiLua.c')
-rw-r--r--ClientHamr/GuiLua/GuiLua.c105
1 files changed, 33 insertions, 72 deletions
diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c
index befc582..94a29eb 100644
--- a/ClientHamr/GuiLua/GuiLua.c
+++ b/ClientHamr/GuiLua/GuiLua.c
@@ -34,7 +34,11 @@ scripts can have a poper GUI for a change.
34 34
35NOTES and TODOs - 35NOTES and TODOs -
36 36
37Making these packages all a sub package of skang seems like a great idea. 37Making these packages all a sub package of skang seems like a great
38idea. On the other hand, looks like most things are just getting folded
39into skang anyway. See
40http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf part 15.5 for
41package details.
38 42
39See if I can use LuaJIT FFI here. Since this will be a library, and 43See if I can use LuaJIT FFI here. Since this will be a library, and
40skang apps could be written in C or Lua, perhaps writing this library to 44skang apps could be written in C or Lua, perhaps writing this library to
@@ -76,76 +80,16 @@ we will be using Lua tables anyway. B-)
76*/ 80*/
77 81
78 82
79/* coordinates and sizes
80
81Originally skang differentiated between pixels and character cells,
82using plain integers to represent pixels, and _123 to represent
83character cells. The skang TODO wanted to expand that to percentages
84and relative numbers. We can't use _123 in Lua, so some other method
85needs to be used. Should include those TODO items in this new design.
86
87Specifying character cells should be done as strings - "123"
88
89Percentages can be done as small floating point numbers between 0 and 1,
90which is similar to Edje. Since Lua only has a floating point number
91type, both 0 and 1 should still represent pixels / character cells -
92
930.1, 0.5, "0.2", "0.9"
94
95Relative numbers could be done as strings, with the widget to be
96relative to, a + or -, then the number. This still leaves the problem
97of telling if the number is pixels or character cells. Also, relative
98to what part of the other widget? Some more thought needs to be put
99into this.
100
101*/
102
103
104/* thing package 83/* thing package
105 84
106matrix-RAD had Thing as the base class of everything. Lua doesn't have 85Currently this is in skang.lua, but should bring this in here later.
107inheritance as such, but an inheritance structure can be built using
108Lua's meta language capabilities. I think we still need this sort of
109thing. Java inheritance and interfaces where used. There's quite a few
110variations of OO support has been written for Lua, maybe some of that
111could be used? http://lua-users.org/wiki/ObjectOrientedProgramming
112
113Other useful links -
114
115http://lua-users.org/wiki/ClassesViaModules (not in the above for some reason.
116http://lua-users.org/wiki/MetamethodsTutorial
117http://lua-users.org/wiki/MetatableEvents
118
119http://lua-users.org/wiki/MechanismNotPolicy
120http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf
121http://lua-users.org/lists/lua-l/2011-10/msg00485.html
122http://lua-users.org/wiki/LuaModuleFunctionCritiqued
123
124On the other hand, Thing as such might just vanish and merge into
125various Lua and metatable things. Seems that's what is going on. We
126didn't really need much OO beyond this anyway.
127
128Each "users session" (matrix-RAD term that came from Java
129applets/servlets) has a ThingSpace, which is a tree that holds
130everything else. It holds the class cache, commands, loaded modules,
131variables and their values, widgets and their states. In matrix-RAD I
132built BonsiaTree and LeafLike, for the old FDO system I built dumbtrees.
133Perhaps some combination of the two will work here? On the other hand,
134with Lua tables, who needs trees? lol
135 86
136Get/set variables would be done here, though the widget package, for 87*/
137instance, would override this to deal with the UI side, and call the
138parents function to deal with the variable side -
139 88
140foo:set('stuff')
141bar = foo:get()
142 89
143Also, since skang Lua scripts should be defined as modules, we can use 90/* skang package
144module semantics -
145 91
146local other = require('otherPackageName') 92Currently this is in skang.lua, but should bring this in here later.
147other.foo = 'stuff'
148bar = other.foo
149 93
150*/ 94*/
151 95
@@ -162,13 +106,6 @@ database stuff for now, but should keep it in mind.
162*/ 106*/
163 107
164 108
165/* skang package
166
167Currently this is in skang.lua, but should bring this in here later.
168
169*/
170
171
172/* widget package 109/* widget package
173 110
174Should include functions for actually dealing with widgets, plus a way 111Should include functions for actually dealing with widgets, plus a way
@@ -199,6 +136,30 @@ this.bar = 'new first choice' .. this.bar
199*/ 136*/
200 137
201 138
139/* coordinates and sizes
140
141Originally skang differentiated between pixels and character cells,
142using plain integers to represent pixels, and _123 to represent
143character cells. The skang TODO wanted to expand that to percentages
144and relative numbers. We can't use _123 in Lua, so some other method
145needs to be used. Should include those TODO items in this new design.
146
147Specifying character cells should be done as strings - "123"
148
149Percentages can be done as small floating point numbers between 0 and 1,
150which is similar to Edje. Since Lua only has a floating point number
151type, both 0 and 1 should still represent pixels / character cells -
152
1530.1, 0.5, "0.2", "0.9"
154
155Relative numbers could be done as strings, with the widget to be
156relative to, a + or -, then the number. This still leaves the problem
157of telling if the number is pixels or character cells. Also, relative
158to what part of the other widget? Some more thought needs to be put
159into this.
160
161*/
162
202 163
203/* introspection 164/* introspection
204 165