...
|
...
|
@@ -137,27 +137,72 @@ var knobsClass = {
|
137
|
137
|
},
|
138
|
138
|
|
139
|
139
|
NavigateMenu : func (d) {
|
|
140
|
+ # d: direction for searching the next selection (-1 or +1)
|
|
141
|
+ # i : index of the object (not the canvas object)
|
|
142
|
+ # state.scroll.offset : offset between canvas object pointed by i
|
|
143
|
+ # and object in state hash,
|
|
144
|
+ # selected : the canvas object id selected
|
|
145
|
+ # id: the id of the window
|
140
|
146
|
var (id, selected) = split('-', me.device.windows.selected);
|
141
|
147
|
var state = me.device.windows.state[id];
|
142
|
|
- for (var i = selected + d; i >= 0 and i < size(state.lines); i += d) {
|
143
|
|
- if (find('editable', state.lines[i].type) > -1) {
|
144
|
|
- state.lines[i].type = string.replace(state.lines[i].type,
|
145
|
|
- 'editable', 'selected');
|
146
|
|
- state.lines[selected].type = string.replace(state.lines[selected].type,
|
|
148
|
+ selected += state.scroll.offset;
|
|
149
|
+ # foreach object, beginning at the selected object, offset applied
|
|
150
|
+ for (var i = selected + d; i >= 0 and i < size(state.objects); i += d) {
|
|
151
|
+ if (i > state.scroll.end
|
|
152
|
+ and d > 0
|
|
153
|
+ and state.scroll.lower < state.scroll.last) {
|
|
154
|
+ me._navigatemenu_scrolldown(state, id, i);
|
|
155
|
+ }
|
|
156
|
+ elsif (i - state.scroll.offset < state.scroll.begin
|
|
157
|
+ and d < 0
|
|
158
|
+ and state.scroll.upper > 0) {
|
|
159
|
+ me._navigatemenu_scrollup(state, id, i);
|
|
160
|
+ }
|
|
161
|
+ if (find('editable', state.objects[i].type) > -1) {
|
|
162
|
+ state.objects[selected].type = string.replace(state.objects[selected].type,
|
147
|
163
|
'selected', 'editable');
|
148
|
164
|
me.device.windows.window[me.device.windows.selected]
|
149
|
165
|
.setDrawMode(0x01)
|
150
|
166
|
.setColor(0,1,1);
|
151
|
|
- me.device.windows.window[id ~ '-' ~ i]
|
|
167
|
+ state.objects[i].type = string.replace(state.objects[i].type,
|
|
168
|
+ 'editable', 'selected');
|
|
169
|
+ me.device.windows.window[id ~ '-' ~ (i - state.scroll.offset)]
|
152
|
170
|
.setDrawMode(0x05)
|
153
|
171
|
.setColorFill(0,1,1)
|
154
|
172
|
.setColor(0,0,0);
|
155
|
|
- me.device.windows.selected = id ~ '-' ~ i;
|
|
173
|
+ me.device.windows.selected = id ~ '-' ~ (i - state.scroll.offset);
|
156
|
174
|
break;
|
157
|
175
|
}
|
158
|
176
|
}
|
159
|
177
|
},
|
160
|
178
|
|
|
179
|
+ _navigatemenu_scrolldown : func (state, id, i) {
|
|
180
|
+ state.scroll.upper = state.objects[i].scrollgroup - state.scroll.lines + 1;
|
|
181
|
+ state.scroll.lower = state.objects[i].scrollgroup;
|
|
182
|
+ state.scroll.offset = state.scroll.upper * state.scroll.columns;
|
|
183
|
+
|
|
184
|
+ # foreach canvas object in the scrolling area
|
|
185
|
+ for (var l = state.scroll.begin; l <= state.scroll.end; l += 1) {
|
|
186
|
+ var t = state.objects[l + state.scroll.offset].text;
|
|
187
|
+ me.device.windows.window[id ~ '-' ~ l]
|
|
188
|
+ .setText(t);
|
|
189
|
+ }
|
|
190
|
+ },
|
|
191
|
+
|
|
192
|
+ _navigatemenu_scrollup : func (state, id, i) {
|
|
193
|
+ state.scroll.upper = state.objects[i].scrollgroup;
|
|
194
|
+ state.scroll.lower = state.objects[i].scrollgroup + state.scroll.lines - 1;
|
|
195
|
+ state.scroll.offset = state.scroll.upper * state.scroll.columns;
|
|
196
|
+
|
|
197
|
+ # foreach canvas object in the scrolling area
|
|
198
|
+ for (var l = state.scroll.begin; l <= state.scroll.end; l += 1) {
|
|
199
|
+ print('l + state.scroll.offset:',l + state.scroll.offset,' = ',l,' + ',state.scroll.offset);
|
|
200
|
+ var t = state.objects[l + state.scroll.offset].text;
|
|
201
|
+ me.device.windows.window[id ~ '-' ~ l]
|
|
202
|
+ .setText(t);
|
|
203
|
+ }
|
|
204
|
+ },
|
|
205
|
+
|
161
|
206
|
FmsInner : void,
|
162
|
207
|
FmsOuter : void
|
163
|
208
|
};
|