rbcurse 1.1.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/NOTES ADDED
@@ -0,0 +1,1536 @@
1
+ NOTES
2
+ =====
3
+ /// vim:ts=4:sw=4:tw=80:ai:formatoptions=tcqnl:
4
+ /// this was posted with appenddiary.sh
5
+
6
+ Subject: Update rubyforge
7
+ -------------------------
8
+
9
+ To update the file named index.html on rubyforge use this. password is in
10
+ rubyforge config file.
11
+
12
+ scp index.html rkumar@rubyforge.org:/var/www/gforge-projects/rbcurse
13
+
14
+ * * *
15
+
16
+ Subject: subwin benefit
17
+ -----------------------
18
+ Date: 2009-10-09 23:32
19
+
20
+ Just found out after playing with subwins that they don't let you write onto
21
+ the window below. Perfect for us for components that overwrite!! However, no
22
+ way to hide a subwin for later display
23
+
24
+ * * *
25
+
26
+ Subject: Upgrading widgets
27
+ --------------------------
28
+ Date: 2009-11-02 14:45
29
+
30
+ 1. We need to use `create_buffer` either in constructor or repaint or whenever
31
+ you are likely to have a width and height. Recommended in beginning of
32
+ repaint().
33
+ Use `safe_create_buffer`
34
+
35
+ 2. Use `@buffer_modified = true` in repaint
36
+
37
+ 3. Ensure `print_border` and `printstring` are getting correct coordinates. Most
38
+ errors happen here.
39
+
40
+ 4. Replace @form.window with @graphic
41
+
42
+ 5. `set_form_col` needs to call `setrowcol` as in rtextarea.
43
+ Also, you need to add cols_panned and rows_panned so the widget knows
44
+ how much it as been panned, and keeps the cursor in correct place.
45
+
46
+ 6. `set_form_row` needs to call setrowcol as in rtextarea. See above entry
47
+ for details.
48
+
49
+ 7. Need to add the following in initialization of container such as rscrollpane
50
+ or rsplitpane:
51
+ `should_create_buffer true`
52
+
53
+ Also when creating a widget to put inside a container, use this line (see
54
+ samples below), as this needs to happen at construction time.
55
+ (This is in the application file when creating an instance, not the widget class).
56
+
57
+ 8. Remove any `dsl_accessor` on height or width since this will override widget.
58
+ If you create a method, call `super()`. You need to create a method called
59
+ height and width in order to pass delta down to children components if
60
+ applicable, also call `super`.
61
+
62
+ 9. You may have to `print_borders()` in `repaint()`, checking for `@repaint_all` (see
63
+ rtextview.rb). i.e, don't print just once in constructor, since when the
64
+ object is placed inside a splitpane, its size can change.
65
+
66
+ if @should_create_buffer
67
+ $log.debug " overriding editors comp with GRAPHIC #{@graphic} " editor.component.override_graphic(@graphic) # 2010-01-05 00:36 TRYING OUT BUFFERED
68
+ end
69
+
70
+ See testscrollp.rb or testscrollta.rb for working sample.
71
+
72
+ * * *
73
+
74
+
75
+ Subject: Scrollpane's form
76
+ --------------------------
77
+ Date: 2009-12-27 20:08
78
+
79
+ Since scrollpane's child object has no form, scrollpane needs to have its own form
80
+ and hand it to child object. However, set_form was overwriting the existing @graphic
81
+ so nothing was printed.
82
+ Had to put a check so graphic (buffer) not overwritten. Now the child object does
83
+ print correctly with a form object. No crashing regarding nil form.
84
+
85
+ 1. Container objects such as scrollpane and splitpane which have widgets
86
+ with nil forms require to create a form using existing graphic object
87
+ as window and hand that to the child objects.
88
+
89
+ * * * * * * * *
90
+
91
+ Subject: Moving cursor in ScrollPane's child
92
+ --------------------------------------------
93
+ Date: 2009-12-28 23:19
94
+
95
+ Since child has its own form, had to hack an if clause in child object
96
+ (ListScrollable in the case of Textarea) to modify parent forms row and col.
97
+ Also added a parent_form in form.
98
+
99
+ However, this needs to be done in scrollpane or other higher up place, so i
100
+ don't have to keep doing it.
101
+
102
+ ALso what if there are multiple objects in a heirarchy. Splitpane contains
103
+ another Splitpane which contains some object. The setting must bubble up all the
104
+ way.
105
+
106
+ * * * * * * * *
107
+
108
+ Subject: class Form - set_form_rowcol
109
+ -------------------------------------
110
+ Date: 2009-12-29 15:28
111
+
112
+ Form should have a method rather than allow direct setting.
113
+ This method can percolate up to a parent form if not the same as current.
114
+
115
+ * * * * * * * *
116
+
117
+ Subject: More on scrollpane and other widgets
118
+ ---------------------------------------------
119
+ Date: 2009-12-30 18:03
120
+
121
+ I have added a Form.rows_panned and cols_panned, so that a form know
122
+ how much its objects have been panned by. Otherwise there was no way
123
+ of Textarea knowing it had been panned. It would keep resetting the
124
+ cursor to the wrong value. rows_panned allows it to account for panning
125
+ so the cursor can flash at where insertion is happening.
126
+ See Scrollpane, handle_keys, around line 224.
127
+
128
+ * * * * * * * *
129
+
130
+ Subject: Scrollpane's cursor out of bounds - known bug
131
+ ------------------------------------------------------
132
+ Date: 2009-12-31 09:42
133
+
134
+ I've tried various ways to handle this - currently a variable named
135
+ outofbounds. However, some little logic error causes the cursor
136
+ to lose synch with the caret (insertion point).
137
+
138
+ So until I can sort that out, we live with the cursor going cruising
139
+ across the screen, although it does remain very true to the insertion
140
+ point so no data can get mucked up.
141
+
142
+ * * * * * * * *
143
+
144
+ Subject: more thoughts on cursor display
145
+ ----------------------------------------
146
+ Date: 2009-12-31 17:14
147
+
148
+ I deleted the todo item regarding widgets maintain cursor display
149
+ themselves, but now i think the insertion point is specfic to some
150
+ widgets not all, and that the widget should perhaps maintain it
151
+ themselves.
152
+
153
+ Most widgets highlight a line or item within. There is no editing
154
+ happening. On a GUI there really is no cursor. However, textfields and
155
+ textareas do have an insertion point (caret?). If they maitain their own
156
+ insertion points, then when they are hidden or panned, the cursor would
157
+ get hidden automatically since i assume its painted onto the buffer or
158
+ pad.
159
+
160
+ For example, tabbedpanes work just fine in these widgets since they take
161
+ care fo their ownfocssing and selection.
162
+
163
+ * * * * * * * *
164
+
165
+ Subject: Textarea overwrite problem
166
+ -----------------------------------
167
+ Date: 2010-01-03 17:54
168
+
169
+ I think it's like this.. (reference test2.rb sample program)
170
+
171
+ Textarea uses a pad, which does a `prefresh` onto screen.
172
+ All the other widgets (unbuffered) write to a window which does a
173
+ `wrefresh`. This refresh overwrites the write that `prefresh` did.
174
+
175
+ Acco to the manpage, certain optimizations are done with what is
176
+ already there on the screen. My guess is that a window wrefresh does not
177
+ disturb what is on the right, but it does overwrite what's on the left.
178
+
179
+ Now, scrollpane and splitpane use a `buffer_to_screen` passing their own
180
+ graphic object, so the main window is written onto. I need to confirm
181
+ this by placing something on the right. Here, since textarea was not a
182
+ child or embedded object, a `pad.refresh` was done.
183
+
184
+ I think i need to ensure that a `copy_pad_to_win` is done in these cases,
185
+ by passing a graphic object. At least the source of this bug is now
186
+ clear to me now.
187
+
188
+ * * * * * * * *
189
+
190
+ Subject: Thoughts on the buffered (pad) approach
191
+ ------------------------------------------------
192
+ Date: 2010-01-05 12:03
193
+
194
+ Buffering all widgets means that there will be a huge number of pads
195
+ beign created for a screen that has a lot of fields. Lots of copying and
196
+ possibilities of errors.
197
+
198
+ In ordinary cases, there should be only one window, as in the old
199
+ version. The buffered approach is only required if a scrollpane or
200
+ splitpane is being used, even there only what is embedded will create its
201
+ own buffer. That simplifies the whole thing. The usual execution path
202
+ will be the old simple one.
203
+
204
+ It may make more sense for the container to pass a buffer to the child
205
+ and so on, rather than each level creating a buffer and copying to the
206
+ higher level. That may totally eliminate having to create buffered
207
+ objects, just have scrollpane and splitpane create a buffer and hand it
208
+ down. I need to think this over, why did i not think of this before.
209
+
210
+ The reason for this is that each level does not know what will be
211
+ displayed and what will be truncated. So it writes things out full,
212
+ or as much is the widget coordinates. The next level does the relevant
213
+ truncation. So the current approach is correct, however, when it can be
214
+ avoided and one window used, only one should be. This will be in 99%
215
+ cases. In anycase, listbox, textarea and textview and table implement
216
+ their own scrolling, so one really does not need scrollpane for them.
217
+ Scrollpane may be needed when we create a scrollable form.
218
+
219
+ So we can have a `should_buffer(boolean)`, which goes the buffer route (if
220
+ set true by parent), else things continue with a form.window as before.
221
+
222
+ added later 2010-01-05 13:24 :
223
+ Regarding conditional buffering, what if some component containing components,
224
+ such as a listbox or table containing editor components is place in a form which
225
+ is placed in a scrollpane. The scrollpane can set `should_buffer` for the child,
226
+ but what of all the lower components ? Should this be passed down ?
227
+
228
+ * * * * * * * *
229
+
230
+ Subject: Implementing a scrollable form
231
+ ---------------------------------------
232
+ Date: 2010-01-05 12:34
233
+
234
+ Two approaches come to mind:
235
+
236
+ 1. Create a form using a pad (i/o of a window). Form will have to
237
+ handle scroll keys if child does not handle them.
238
+ Ensure that pad writes onto physical screen, not a window (like it
239
+ used to).
240
+
241
+ 2. Create the usual window and scrollpane.
242
+ Make the child a form-widget -- a widget that contains a form, sends
243
+ messages to form. However, the form should be based on a pad.
244
+
245
+ In both cases, a form is based on a pad, so objects can be placed in
246
+ a larger area than the physical screen.
247
+
248
+ * * * * * * * *
249
+
250
+ Subject: form.setrowcol and rowcol
251
+ ----------------------------------
252
+ Date: 2010-01-05 21:11
253
+
254
+ i began setting both row and col from `set_form_row`, but it does not know
255
+ the current col. `rowcol` seems to return the position where printing
256
+ should start, or the cursor should be positioned on entry first time.
257
+
258
+ So i am now passing nil for c, so col is not disturbed.
259
+ test2.rb's listbox is now editing fine, cursor is moving when editing.
260
+ However, in scrollpane with pads etc, the cursor is not moving.
261
+
262
+ * * * * * * * *
263
+
264
+ Subject: embedded splitpanes
265
+ ----------------------------
266
+ Date: 2010-01-07 19:19
267
+
268
+ *Case*: splitpane within another splitpane.
269
+
270
+ *Examples*: ruby doc or java doc. Now think text mode, no mouse, no
271
+ dragging. Open ruby docs or java docs in `links`.
272
+
273
+ Lets take a realistic scenario of a splitpane which contains a splitpane
274
+ as one (or both) components. We've defined some key/s to resize a
275
+ splitpane, but now which splitpane gets the key. How does the user
276
+ specify which level the key pertains to.
277
+
278
+ In textual browsers such as links, "frames" have been used. So you are
279
+ inside a frame. Your key pertains to that frame and you tab between
280
+ frames. Using splitpanes, when you are in a component you are inside a
281
+ splitpane too. So in the case of a splitpane within another, you are in
282
+ 2 splitpanes.
283
+
284
+ When you tab into a splitpane, I'd like to make it easy and put the
285
+ focus inside the first component. You can switch between components. But
286
+ you are never really focussed on the splitpane. Any keys not processed
287
+ by the child components are passed up to the splitpane. Thats how it
288
+ does resizing, or changing orientation.
289
+
290
+ The other option is that you first focus on the splitpane, and then tab
291
+ once more to the first component. Ugh ! But it allows you use simple
292
+ keys like plus and minus to resize. Thus in a multilevel scrollpane,
293
+ you'd need many tabs to get to the actual component.
294
+
295
+ There's a third option, i do as before, but give a special key to go to
296
+ outer splitpane, so conditionally focus can go onto splitpane.
297
+
298
+ * * * * * * * *
299
+
300
+ Subject: repaint_all
301
+ --------------------
302
+ Date: 2010-01-08 20:29
303
+
304
+ I have added repaint_all and repaint_required in class Widget.
305
+ Sometime a parent wants to tell its child to repaint, and there's no
306
+ way. The only way was to fire a handler.
307
+
308
+ Also added a repaint_all, so if some widgets want to print a border or
309
+ clear area only on a major change (like dimension change), they can use
310
+ this flag. Calling repaint_all, sets repaint_required also. The latter
311
+ is for usual data changes.
312
+
313
+ * * * * * * * *
314
+
315
+ Subject: Splitpane and cascading dimension changes to child
316
+ -----------------------------------------------------------
317
+ Date: 2010-01-09 20:37
318
+
319
+ **Splitpane**, moving divider.
320
+
321
+ Now by default, changes to width and height are *not* cascaded to child
322
+ components.
323
+ However, as and when the divider is increased beyond size of first
324
+ component, the first component will enlarge and automatically its buffer
325
+ is resized.
326
+
327
+ I've also worked on preventing the crash. Essentially, the screen_buffer
328
+ should not become less than the components pane. This can happen in 2
329
+ ways, one is the buffer is resized whenever component increases. I was
330
+ (by oversight) overriding widget's height having defined a dsl_accessor
331
+ in textview.
332
+
333
+ However, if you don't want to resize the buffer, then one should not
334
+ call `set_screen_max_row_col` if it exceeds the warning condition. This
335
+ warning is if one is creating a new widget, if it crashes on `copywin`
336
+ and Height is more than `smaxrow()` then you'll have a crash. So resize
337
+ at that time by simply increasing the widgets height, or else put a
338
+ check in widget so that the method is not called for this condition.
339
+
340
+ * * * * * * * *
341
+
342
+ Subject: maxlen in rtextview
343
+ ----------------------------
344
+ Date: 2010-01-10 19:28
345
+
346
+ Made a change in rtextview.
347
+ In the constructor, maxlen if nil was set to width-2.
348
+ So, if width was changed later maxlen would remain the same. And maxlen
349
+ is used as the length (width) of the content to print.
350
+
351
+ I've never changed the width at runtime, till today, from splitpane, and
352
+ this came out. So now unless you explicitly set maxlen, it must remain
353
+ nil and be set locally in each method as width-2.
354
+
355
+ I supposed the same has to be done in rtextarea.
356
+
357
+ * * * * * * * *
358
+
359
+ Subject: copy_pad_to_win
360
+ ------------------------
361
+ Date: 2010-01-11 23:47
362
+
363
+ More and more scenarios are coming up when copy_pad_to_win can either
364
+ return a -1 and do nothing, or print less that it should be.
365
+
366
+ I can't correct more of these in the method, since that would break some
367
+ other situation. I have added warnings, though. One will have to check
368
+ the log file and see what warnings have been printed. If none, then we
369
+ have a new scenario, and the data has to be inspected to figure out.
370
+
371
+ * * * * * * * *
372
+
373
+ Subject: regarding create_buffer in repaint
374
+ -------------------------------------------
375
+ Date: 2010-01-12 12:54
376
+
377
+ If a widget calls `create_buffer` in repaint, it uses some default values
378
+ such as for top and left (0,0). To change these values, from a parent
379
+ component such as splitpane, means i change after `repaint()` so the first
380
+ paint is off by one row and col. The subsequent paint is okay.
381
+
382
+ I need to be able to pass values to a widget prior to `repaint()`, so its
383
+ `create_buffer` can be influenced.
384
+
385
+ * * * * * * * *
386
+
387
+ Subject: cursor positioning form#setrowcol
388
+ ------------------------------------------
389
+ Date: 2010-01-12 22:53
390
+
391
+ Since i currently go up a heirarchy of forms, passing up the row and col
392
+ to be set, i cannot add the col and row offsets of the parent
393
+ (enclosing) widgets.
394
+ Had i gone up a heirarchy of widgets, I could have added their offsets.
395
+
396
+ In any case, i think I need to add them as parents, in methods like
397
+ `child()` or `first_component`. Then a method will be needed to pass values
398
+ up, and when no parent then set in its form. Each level adds its offset.
399
+
400
+ OTOH, another option would be when setting a child component, to once and for
401
+ all pass down cumulative offsets. Thus, one will not have to keep adding.
402
+ However, it is inefficient, is it not to propogate each cursor move up. Won't
403
+ that be slow ?
404
+ For that matter, won't this copying buffer be slow. Is there no faster way out?
405
+
406
+
407
+ In the case of multiple embedded components, can we not pass down the offsets
408
+ and boundaries when setting or moving so that each component writes directly,
409
+ and the cursor can be set easily without passing up ? There is a one time
410
+ passing down on creation, and moving or resizing. Each component knows its own
411
+ absolute position on the form, and there's basically only one form (except maybe
412
+ for tabbed panes).
413
+
414
+ Buffers means that scrollpanes for example only scroll a buffer, the widget does
415
+ not have to redraw repeatedly. Repainting is higher level code with many type
416
+ conversions, slicing, formatting etc, scrolling is merely a low-level copywin()
417
+ call. however, copywin() seems a lot more prone to error (new situations).
418
+
419
+ Direct painting without a buffer means constant repainting on scrolling, like
420
+ happens when we use TextViews and listboxes inbuilt scrolling.
421
+ Otoh, it means each component has to implement scrolling. With a scrollpane, we
422
+ can have scrollpane do the job, although the child has to write onto a pad.
423
+ * * * * * * * *
424
+
425
+ Subject: update to cursor positioning
426
+ -------------------------------------
427
+ Date: 2010-01-13 18:26
428
+
429
+ Just studied the code to see how each textview knows where to print
430
+ inside splitpanes. Each component's `@col` is set to where printing has to
431
+ start, that's all. I was mistakenly using `@orig_col` which is never
432
+ updated.
433
+ Now its fine, which means I don't need `widget#setformrowcol`, the earlier
434
+ `form#setrowcol` is fine. Don;t use orig_col in setting cursor,
435
+ applies to rtextarea.rb, too.
436
+
437
+ * * * * * * * *
438
+
439
+ Subject: speed of splitpane, copying buffers
440
+ --------------------------------------------
441
+ Date: 2010-01-14 15:44
442
+
443
+ One can type fast in a textarea as is and see updates immediately. But
444
+ when the textarea is inside a splitpane, due to the buffer copying
445
+ happening, fast typing updates take time to show up.
446
+
447
+ Sequence would be as follows:
448
+ 1. textarea buffer copies onto splitpane buffer
449
+ 2. Splitpane buffer copies to main form window (earlier it would copy to
450
+ screen directly)
451
+ 3. form.window does a wrefresh.
452
+
453
+ Each time you type a character, it goes through the above. We need to
454
+ get the innermost widget buffer to write directly to the form.window
455
+ somehow.
456
+
457
+ Also a quick cursor movement, shows the cursor flashing on row below now
458
+ and then, although when you move the cursor slowly, it move fine.
459
+
460
+ * * * * * * * *
461
+
462
+ Subject: slitpanes in a mouseless CUI environment
463
+ -------------------------------------------------
464
+ Date: 2010-01-15 13:02
465
+
466
+ The issue here is navigating between panes, if you have splitpanes
467
+ embedded between splitpanes. Typically, control goes to the first
468
+ component, and switching happens between the 2 panes of the first
469
+ component.
470
+ I've defined TAB to do a switch on the outer component, but that only
471
+ delays or reduces the problem.
472
+
473
+ We need another component, more like vim's splits. You can split it as
474
+ many times. Each split returns 2 handles. You can split the handle. You
475
+ can place a component in the handle. Once it is all in one component,
476
+ one can reorder and exchange positions too.
477
+
478
+ Expanding contracting can de done with current split in focus. With
479
+ embedded splitpanes, we don't know which level the user is intending the
480
+ resize (or motion) key for.
481
+
482
+ * * * * * * * *
483
+
484
+ Subject: cursor positioning in mult splitpanes
485
+ ----------------------------------------------
486
+ Date: 2010-01-15 23:26
487
+
488
+ When placing textviews inside 2 splitpanes, a funny thing happened, i found that
489
+ the cursor was always on 5,5, no matter where the outer split was placed. Appa,
490
+ we need to add the outer windows left and top offsets.
491
+
492
+ I have done that, and now the cursor is in the right place regardless of whether
493
+ there are 2 or 1 splitpanes.
494
+
495
+ Now both setformrowcol and setrowcol are correct. However, i think the form
496
+ route of setrowcol is better since a form's offset won't get duplicated.
497
+
498
+ * * * * * * * *
499
+
500
+ Subject: container widgets
501
+ --------------------------
502
+ Date: 2010-01-16 23:57
503
+
504
+ Widgets such as splitpane, scrollpane, viewport and any future widgets should be
505
+ able to pass changes to dimensions down to their children.
506
+
507
+ So they should have a `height` and `width` method that adds the delta to the
508
+ child, or relevant children. and calls `super`, so that buffers can be
509
+ rebuilt.
510
+
511
+ * * * * * * * *
512
+
513
+ Subject: scrolling and wrefresh
514
+ -------------------------------
515
+ Date: 2010-01-19 12:26
516
+
517
+ Suggested optimizations to pad and `wclear.`
518
+ Currently, i have to do a `wclear` everytime i scroll a pad or else
519
+ previously displayed data if often not cleared off and remains.
520
+ **Can this extra clearing be avoided**. i once tried `clr_to_bot` but
521
+ did not seem to work.
522
+
523
+ This happens when we scroll past last row (or last col in horizontal
524
+ scrolling).
525
+
526
+ Options to reduce or obviate `wclear:`
527
+
528
+ 1. Get scroll exactly so that no empty rows or columns shown. Very
529
+ dicey.
530
+
531
+ 2. `wclear` only after a point when reaching the end. Setting some flag.
532
+ e.g. when `number of rows < scrollatrow().`
533
+
534
+ 3. Don't clear entire window, but only the region you don't paint over.
535
+ Try clear to bottom again.
536
+
537
+ 4. Define pad larger (extra rows by size of widget) so that there's
538
+ alway that much blank rows there. Same for width.
539
+ If displaying 100 rows in a 10 row widget, define pad as 110, so when
540
+ scrolling last page, there's always blank space ahead. This should
541
+ totally obviate `wclear`.
542
+
543
+ * * * * * * * *
544
+
545
+ Subject: scrollpane updates
546
+ ---------------------------
547
+ Date: 2010-01-19 19:40
548
+
549
+ A scrollpane only clears and repaints the entire area if its size is
550
+ changed or it is scrolled. In such cases, the `repaint_all` variable is set
551
+ to true.
552
+
553
+ In all other cases, it only copies the child's buffer up. This is
554
+ required otherwise changes to the child will not show up at all. Thus,
555
+ changes to `rviewport` and `rscrollpane` have been made.
556
+
557
+ The awful flashing has stopped, however all test programs that use
558
+ Scrollpane have to be retested -- YAY !
559
+
560
+ Isn't testing over and over again such fun.
561
+
562
+ * * * * * * * *
563
+
564
+ Subject: cursor display by widget itself
565
+ ----------------------------------------
566
+ Date: 2010-01-20 22:21
567
+
568
+ Would be so cool if widgets could display cursor themselves as a mark or
569
+ attribute.
570
+ That has pros and cons:
571
+
572
+ - At a terminal level, one cannot change cursor color or attributes. It
573
+ would be programmed.
574
+
575
+ + OTOH, we would not have to test and ensure that cursor is being set
576
+ when an object is embedded and does not have access to the top form
577
+ that is setting the cursor.
578
+
579
+ - But, when the cursor moves, we would have to erase the cursor and add
580
+ it elsewhere. that could resul in a cursor left behind in one widget
581
+ when we jump to another.
582
+
583
+ + In scrolling the mark would just move along. No programming required.
584
+
585
+ - if a widget forgets to erase or set cursor on events like on_enter
586
+ on_leave, we could have multiple cursors.
587
+
588
+ Perhaps editable widgets such as textarea or ones that allow cursor
589
+ movement like listbox and textview could at least show an insertion
590
+ point or caret of some sort. So even if cursor always hangs around at
591
+ top left corner of active widget, the insertion point can be shown as an
592
+ underline or something. (UL's don't work in all TERMS).
593
+
594
+ Let's think about some kind of mark that is independent of the cursor.
595
+ One huge headache for scrollpanes, textareas etc would be taken care
596
+ off. Issue is, does TA or TV really know where the insertion point is.
597
+ Yes, @current_index and @curpos (i think).
598
+
599
+ * * * * * * * *
600
+
601
+ Subject: cursor positioning
602
+ ---------------------------
603
+ Date: 2010-01-20 23:06
604
+
605
+ If a listbox can paint the row with selection, then surely it can paint
606
+ hte curpos position with a red background for cursor (this can be
607
+ defined at the widget level and overridden per widget if need be).
608
+
609
+ Similarly, textareas have a search highlighting. And i do have
610
+ current_index and curpos. That can be used for setting a cursor upon
611
+ repaint. Worth a try. Should help in the long run.
612
+
613
+ In any case, its high time a widget is informed of its exact coordinates
614
+ no matter how deep it is. Parents can inform children of row and col
615
+ changes. Then the child can itself call wmove and not have to set
616
+ attributes. Also for that the form that is painting, its value should be
617
+ sent (but btw, if the embedded component sets wmove, that will be erased
618
+ when the buffer copying happens).
619
+
620
+ * * * * * * * *
621
+
622
+ Subject: tabbedpanes vs other containers
623
+ ----------------------------------------
624
+ Date: 2010-01-21 18:49
625
+
626
+ Other containers contain an object, so they call its on_enter or
627
+ set_form_row so that cursor is correctly set no matter how deep the
628
+ level of containment.
629
+
630
+ However, `TabbedPane` contains a form. The caller can set what he wants on
631
+ that form. Thus, i am finding that the usual technique that `SplitPanes`
632
+ used for setting the cursor is failing here.
633
+
634
+ This does mean that tabbedpanes can have complete forms inside them with
635
+ multiple buttons, checkboxes etc -- that is absolutely necessary.
636
+
637
+ * * * * * * * *
638
+
639
+ Subject: vim like splitpanes
640
+ ----------------------------
641
+ Date: 2010-01-22 19:39
642
+
643
+ Don't know if I've put this down already. Splitpanes within splitpanes
644
+ is a bit slow if you intend doing very fast typing within a textarea, for
645
+ example.
646
+
647
+ Also since there is no mouse, which split do you intend widening or
648
+ resizing -- a bit of a pain. Setting up sizes of the splits can also be
649
+ dicey at present. For a mouseless environment, perhaps vim editor like
650
+ splits are better. There is only one level for starters.
651
+
652
+ To create splits, take the first pane, split it. You get 2 objects
653
+ (panes). Split them any way you want. You have handles to each split or
654
+ buffer. Place any object you want in each window. Whichever window the
655
+ cursor is on is the one that resizing commands apply to. There is only
656
+ one level so its easy. Again using TAB to cycle between splits will
657
+ work. Similarly, it should be possible to rearrange, kill, add etc at
658
+ will. Or to move to the left or right or top tab.
659
+
660
+ The splits could have scrolling built in, so we don't lose 2 rows and
661
+ cols showing the scrollbars. Scrollbars could be fitted into the split
662
+ itself.
663
+
664
+ * * * * * * * *
665
+
666
+ Subject: form parameter in widget creation
667
+ ------------------------------------------
668
+ Date: 2010-01-22 19:50
669
+
670
+ I am wondering whether the **form parameter** in `Widget` is clunky. Since
671
+ it's often set to nil, in embedded objects, or if you wish to create a
672
+ widget first and hand it off to some other form or list or tabbedpane.
673
+
674
+ The way of creating objects in a DSL'ish way is a bit goofy since I had
675
+ problems putting my head around not being able to overload constructors
676
+ in ruby.
677
+
678
+ This (removing form) would be a major change since it would break
679
+ everything but for future users it could be neater. A form may be added
680
+ to, rather than widgets take the form param and add themselves.
681
+
682
+ This internally breaks code too, since many objects just expect a form
683
+ to be present when created of when some methods are called.
684
+
685
+ This means that the constructor params can have what's actually needed to
686
+ work. Currently even I don't know what's absolutely needed for an object
687
+ to work. What are the minimal requirements ? "Just run it and if it
688
+ crashes with a null pointer assignment, then you know something has to
689
+ be set." That sucks, and embarasses me since I've done *a lot* better in
690
+ the past (in other languages).
691
+
692
+ However, i think that's the way to go.
693
+
694
+ * * * * * * * *
695
+
696
+ Subject: cursor handling internally
697
+ -----------------------------------
698
+ Date: 2010-01-23 20:23
699
+
700
+ I've got textarea to handle cursor painting by itself, BUT ...
701
+ that means each time the widget will have to be copied (for all cursor
702
+ motion) even when the screen does not scroll. Currently, when we use
703
+ window's `wmove`, we do not need to repaint or copy_pad at all.
704
+
705
+ Any write to the graphic object (when in buffered mode) requires the
706
+ buffer to be copied, and that means setting buffer_modified to true.
707
+
708
+ Also note that all cursor motion requires the footer to be painted.
709
+ Currently, some movements are forgetting to do that, and some are - but
710
+ they are repainting the whole textarea just to paint the footer (row and
711
+ col in footer).
712
+
713
+ We should set another flag for updating the footer only. (see `addcol`
714
+ and `addrowcol`).
715
+
716
+ I am thinking of making this method paint_internal_cursor conditional.
717
+
718
+ * * * * * * * *
719
+
720
+ Subject: aah the tabbedpane cursor offset issue
721
+ -----------------------------------------------
722
+ Date: 2010-01-26 20:10
723
+
724
+ How daft of me! The tabbedpane's own row and col were resulting in the
725
+ textarea not being able to calculate the correct cursor offset.
726
+ So we do have to look at parent objects and their own row and col, do
727
+ we? But what of scrollpanes and splitpanes ?
728
+
729
+ So basically while setting cursor, i need to add parent's row and col,
730
+ too.
731
+
732
+ * * * * * * * *
733
+
734
+ Subject: microemacs user setup tabbedpane
735
+ -----------------------------------------
736
+ Date: 2010-01-30 00:06
737
+
738
+ Micremacs has user setup tabbedpanes.
739
+ Left and right keys are used to move from one tab to another.
740
+
741
+ Tab jumps to form associated with a tab. Tab does not cycle between
742
+ tabs. IN some fields, where there are selectable values (combos) a "v"
743
+ is shown but i am not clear how to access that list. Pressing Enter
744
+ opens up the config file.
745
+
746
+ * * * * * * * *
747
+
748
+ Subject: tabbedpanes and scrollpanes
749
+ ------------------------------------
750
+ Date: 2010-02-02 23:04
751
+
752
+ I've spent more than 2 days battling a scrollpane inside a tabbedpane.
753
+ It wont print anything. I know what's going on, but unable to fix it.
754
+ Its simple but i am unable to catch it.
755
+
756
+ When i place a textarea directly in a tabbedpane (TP), it takes TP's
757
+ tab form. It does not create its own buffer. It writes to TP's form/pad
758
+ which is then copied to TP's own window. This works.
759
+
760
+ But when i place a textview inside a scrollpane and place that inside a
761
+ TP, it takes the TPs form, but then creates a form and pad, required for
762
+ the child. The TV writes to its own pad, which is then copied to
763
+ Viewport, to Scrollpane, to TP. But at this point, the tab form which
764
+ was given to Scrollpane and not used, kicks in and writes to TP.
765
+
766
+ So whatever was written to TP is overwritten by the unused TP tab
767
+ form/pad. Scrollpane should use this, but it creates its own buffer. If
768
+ i mess with this, all those other programs could go for a toss.
769
+
770
+ * * * * * * * *
771
+
772
+ Subject: scrollpane tabbedpane update
773
+ -------------------------------------
774
+ Date: 2010-02-03 19:06
775
+
776
+ I've finally got something displaying and working .. textview inside a
777
+ scrollpane inside a tabbedpane.
778
+ If the form given to a scrollpane has a pad as a window, then we use the
779
+ pad, if its a window, we do the usual create_buffer crap.
780
+
781
+ However, sadly the positioning is slightly off, the borders and not
782
+ printing fully (left and top not there). I've played around with the
783
+ `row` and `col`, but seems scrollpanes row and col have no impact. Its a
784
+ tricky situation since I have created a second form on the same pad.
785
+
786
+ I cannot set the same form as that passed in since then the mainform
787
+ would own the child inside scrollpane. So its very hackish really - not
788
+ clean. Getting messy -- we need to overhaul this whole new buffered
789
+ stuff - too much copying of buffers and breaking my nut over `copywin`.
790
+
791
+ Need to simplify.
792
+
793
+ * * * * * * * *
794
+
795
+ Subject: return values for form: false vs UNHANDLED
796
+ ---------------------------------------------------
797
+ Date: 2010-02-04 19:12
798
+
799
+ Sometimes some methods like `down`, `up` etc return a `false` if they cannot go
800
+ down or up or scroll. However, when the `ret` is returned up, repainting
801
+ still happens. A form typically won't repaint if the return of
802
+ `handle_key` is `:UNHANDLED`. So, in scrollpane, I've had to convert
803
+ `ret` to `:UNHANDLED` if false, so no useless repainting happens.
804
+
805
+ * * * * * * * *
806
+
807
+ Subject: scrollpane inside tabbepanes PROBLEMS
808
+ ----------------------------------------------
809
+ Date: 2010-02-04 20:52
810
+
811
+ Okay, I've got an idea what's happening.
812
+ This largely is since I've put in an ugly hack to take the PAD of a
813
+ parent form, if its a PAD (not a window). Otherwise, what I was
814
+ printing on Scrollpane's pad was getting overwritten by the TAB's pad
815
+ which was never written to.
816
+
817
+ 1) `ScrollPane` does a `wclear` of the pad. This erases everything earlier
818
+ put on the pad, including the border.
819
+
820
+ 2) Since Scrollpane does not know its picked up some other pad, its
821
+ border height and width are not correct. They would be fine if it had
822
+ created its own pad.
823
+
824
+ The options are:
825
+
826
+ 1. Hack further so that this case is taken care of.
827
+ 2. Do the sensible thing. Create own pad, and somehow copy scrollpane's
828
+ pad onto it at the end.
829
+
830
+ Even though i could not get #2 done, I think I should look into that now,
831
+ so the code is not mysterious and impossible to understand or maintain.
832
+
833
+ Also, I've got to simplify ScrollPane *completely*.
834
+
835
+ * * * * * * * *
836
+
837
+ Subject: maintaining logs and keystrokes
838
+ ----------------------------------------
839
+ Date: 2010-02-07 11:48
840
+
841
+ Maybe one way of my tracking down when something breaks, which is
842
+ happening and is nerve-wrackig since its all UI stuff...
843
+
844
+ Maintain the log file. Also somehow mark what keystrokes we run.
845
+ That way when things break, i can run the same program with same keys
846
+ and compare. Keystrokes actually are already mentioned in file, but it
847
+ would be easier to put them separately.
848
+
849
+ Maybe i could just mail the log files to myself with a comment.
850
+
851
+ * * * * * * * *
852
+
853
+ Subject: reworking cursor positioning
854
+ -------------------------------------
855
+ Date: 2010-02-07 20:44
856
+
857
+ Two approaches:
858
+
859
+ 1. Pass absolute coordinates down all the way, so widget can set abs
860
+ coords for cursor.
861
+ This still needs to go all the way up. Also any changes need to be
862
+ cascaded all the way down.
863
+
864
+ I am trying this.
865
+
866
+ 2. A window or pad should print its own cursor. Why pass it to higher
867
+ forms. That way only absolute position within a pad or window is
868
+ required which is quite simple.
869
+ Also changes can be passed down quite easily.
870
+ However, when a pad prints cursor, control will come back to setpos
871
+ of main form, and it will move the cursor.
872
+ So it an inner pad or window is setting cursor, the main should not.
873
+
874
+ Somehow, mainform should know whether it should set cursor or not.
875
+
876
+ Actually this sounds simpler than option 1.
877
+
878
+ The danger of allowing widgets to set the cursor is that if multiple
879
+ are being updated in a loop, they will all set the cursor, and only
880
+ the last will show up.
881
+ Maybe the selected field can have an attrib, manages_cursor - if yes,
882
+ main form does nothig, assuming either a cursor is not needed, or
883
+ that widget has a form and is handling cursors. Containers will have
884
+ a true value.
885
+
886
+ * * * * * * * *
887
+
888
+ Subject: Major change: buffered version, splitpane, scrollpane NOW
889
+ ------------------------------------------------------------------
890
+ Date: 2010-02-10 11:09
891
+
892
+ Too much breakage, too much debugging -- I need to redo the buffered
893
+ approach largely meaning that:
894
+
895
+ 1. `SplitPane` and `ScrollPane` will have an almost complete rewrite.
896
+
897
+ 2. Window and Widget will be touched, in terms of repainting - only the
898
+ buffered portion, so the classic version of rbcurse should not be
899
+ affected.
900
+
901
+ 3. Yesterday, looking at the show_caret routine (carelessly tacked on
902
+ recently) in `Listscrollable`, I saw some glaring flaws, fixed it and
903
+ now Textviews and Textareas show their own caret (cursor) correctly,
904
+ no matter where they are placed. However, what one needs to do when
905
+ using this, is display it only on_enter, and hide it when on_exit.
906
+
907
+ Also, do remember that using this forces a `repaint` even when you move
908
+ the cursor inside the textarea. The original cursor routine does not
909
+ involve repainting unless scrolling happens due to movement.
910
+
911
+ However, it does solve a HUGE headache regarding cursor display in
912
+ complex setups like scrollpanes within a splitpane within another
913
+ splitpane.
914
+
915
+ To detail point 1.
916
+
917
+ ### Current approach to using buffers (ncurses' Pad):
918
+
919
+ 1. Too many pads which results in slow response, too much copying which
920
+ is very prone to bugs, too much impact of change.
921
+ Its too complex.
922
+
923
+ 2. Copying pads from inner to outer widgets is too messy, very hard to
924
+ debug errors, slow.
925
+
926
+ 3. Need to avoid or minimize pad usage.
927
+
928
+ ### Alternatives:
929
+
930
+ 1. **No pad**
931
+ - This means that we `repaint` each time scrolling happens
932
+ - Widget takes care of cropping and can make errors. Responsibility
933
+ is on each widget to crop. Cropping has to be from both sides, not
934
+ just right.
935
+ Typically, this cropping will happen for each line of a multi-line
936
+ widget. In the `copywin()` case, the widget writes without checking
937
+ len or cropping. The lower level `copywin()` takes care of cropping
938
+ so that's more efficient.
939
+
940
+ This does obviate the recreating of pads that happens due to
941
+ resizing or even setting the parent object's dimensions.
942
+
943
+ 2. Use only **one pad** for the widget that's actually writing such as
944
+ `Textarea` or `Listbox`.
945
+
946
+ This widget is passed the coordinates to crop and the target window
947
+ (typically `form.window`).
948
+ It uses `prefresh()` to write onto form.window using coordinates.
949
+ Most likely this code can be put in superclass `Widget` so there are no
950
+ errors.
951
+ The container such as `Splitpane` and `Scrollpane` merely pass down
952
+ their bounds, so it doesn't matter how many levels there are. Only
953
+ bounds are being passed down and calculated.
954
+
955
+ Now its possibly that the container *suggests* to inner object to use a
956
+ pad. The inner object can if its programmed to, use a pad and use the
957
+ cropping, or it can just paint to the target. In the case of optional
958
+ pads, the widget will have code to crop each line, so that code will
959
+ exist even with a pad.
960
+
961
+ After that, the `Scrollpane` will put its border or scrollbars directly
962
+ onto `form.window` using the bounds it has. Similarly the higher level
963
+ `Splitpane` will paint its own border or divider etc onto the
964
+ `form.window` and so on.
965
+
966
+
967
+ ### Tasks:
968
+
969
+ 1. push all existing code to rbcurse19 branch
970
+
971
+ 2. create a new branch for this change
972
+
973
+ 3. Have `SplitPane` and `ScrollPane` push their dimensions down and paint onto
974
+ `@form.window` directly.
975
+
976
+ 4. Have final widget (`TextArea`, `TextView`, `Listbox`) respect the
977
+ dimensions passed in, and refresh `Pad` onto actual target
978
+ (`@form.window`).
979
+
980
+ * * * * * * * *
981
+
982
+ Subject: method rowcol and offset fields
983
+ ----------------------------------------
984
+ Date: 2010-02-11 21:56
985
+
986
+ method rowcol() is supposed to return the location where form would
987
+ place the cursor by default. So it takes row + row_offset.
988
+ row_offset usually is 1 by default, if you have a border.
989
+
990
+ However, there's some issue with placing an item inside a Scrollpane and
991
+ perhaps others. The buffer is copied with an offset of 1. So rowcol by
992
+ itself does not yield the correct cursor position.
993
+
994
+ If i add 1 to this, many other routines start printing one off. rowcol
995
+ has been used rather extensively because somewhere down the line, i
996
+ forgot its purpose (not having thought it necessary to document it).
997
+
998
+ So i've added a pad_offset in textview, for the pad cases. I know i am
999
+ redoing it and already started hacking.
1000
+
1001
+ * * * * * * * *
1002
+
1003
+ Subject: changes to buffered objects
1004
+ ------------------------------------
1005
+ Date: 2010-02-11 23:21
1006
+
1007
+ Based on what I've done to TextView, to be done to TextArea, ListBox.
1008
+
1009
+ 1. No references to @form.
1010
+ win_left and win_top store window's offsets.
1011
+
1012
+ 2. target_window passed if form not passed.
1013
+
1014
+ 3. move create_buffer to paint.
1015
+ Also, paint buffer here only, no passing up.
1016
+
1017
+ 4. accept buffering_params hash and use for copywin
1018
+
1019
+
1020
+ 5. For textarea, suppress borders.
1021
+
1022
+ -----
1023
+
1024
+ Containers should set should_buffer and pass bounds.
1025
+ Containers themselves do not create buffers. Just pass down.
1026
+ Containers only draw their borders etc.
1027
+ Move this drawing to after the inner object has painted. Paint onto
1028
+ window. Pass down ext_offset + col_offset.o
1029
+
1030
+ Since container are writing to window, add row and col to print-border
1031
+ and other print statements.
1032
+
1033
+ * * * * * * * *
1034
+
1035
+ Subject: ext_offsets explanation
1036
+ --------------------------------
1037
+ Date: 2010-02-13 10:33
1038
+
1039
+ `ext_row_offset` and `ext_col_offset` are essentially for a widget to be
1040
+ able to place the cursor. This is exactly how to set this variable.
1041
+
1042
+ A form, when adding a widget puts its `window.top` and `window.left` as row
1043
+ and col offset respectively.
1044
+
1045
+ In cases, where an object contains another object such as `ScrollPane` or
1046
+ `SplitPane`, ext_row_offset is set to row + ext_row_offset of parent
1047
+ class.
1048
+
1049
+ child.ext_row_offset = @row + @ext_row_offset.
1050
+
1051
+ Thus, this contains the starting point of the widget in absolute terms.
1052
+ This should not be used by any other programs as this is only to cater
1053
+ to `set_form_row` and `set_form_col` and could change to accomodate these 2
1054
+ methods.
1055
+
1056
+ However, the above assignment is at present the correct assignment.
1057
+
1058
+ * * * * * * * *
1059
+
1060
+ Subject: vimsplits or splitpane with subwins
1061
+ --------------------------------------------
1062
+ Date: 2010-02-13 20:14
1063
+
1064
+ I was just checking out `subwins` today and one thing led to another. I
1065
+ basically have a very barebones vim-splitty thing which has subwins for
1066
+ each split - `VimSplit`.
1067
+ It splits in half, yes, i need to allow moving. I've been wasting time
1068
+ putting text in each split.
1069
+ So each split returns 2 subwins. You can either attach a component to a
1070
+ split, so all keys go to it.
1071
+ Or else create a form with that window.
1072
+ Or create a widget with the window, and send keys to it. Attaching a
1073
+ widget to the window is best since it takes care of everything after
1074
+ that.
1075
+
1076
+ We still have to deal with setting the cursor, not sure if set_form_col
1077
+ is meant to deal witha subwin. Also its easy to use subwins.wmove but in
1078
+ our real application, the subwins wmove will get erased by the later
1079
+ windows that refresh.
1080
+
1081
+ * * * * * * * *
1082
+
1083
+ Subject: subwin does not resize and move
1084
+ ----------------------------------------
1085
+ Date: 2010-02-13 23:05
1086
+
1087
+ subwins were working great for my splitpane (vimsplit) till i needed to
1088
+ implement the pane movement. That requires moving and resizing subwins.
1089
+ This was not happening since the coords are relative to the parent
1090
+ window, and somehow this link is lost. The moved window lands up with
1091
+ its relative coordinates as absolute coords now.
1092
+
1093
+ The man page says that subwindows resizing and movement should be
1094
+ avoided. Another page says:
1095
+
1096
+ > The subwindow functions (subwin, derwin, mvderwin, wsyncup, wsyncdown,
1097
+ > wcursyncup, syncok) are flaky, incompletely implemented, and not well
1098
+ > tested.
1099
+
1100
+ I could delete and recreate 2 new windows when a split pane's split is
1101
+ moved, but the reference to the window would change, and programs using
1102
+ that ref would keep referring a destroyed window.
1103
+
1104
+ It was too good to be true. I guess I have to go back to `pads` and `copywin` which
1105
+ I've learned to hate.
1106
+
1107
+ * * * * * * * *
1108
+
1109
+ Subject: subwins > derwin
1110
+ -------------------------
1111
+ Date: 2010-02-14 12:06
1112
+
1113
+ Okay, i've got ncurses subwins to resize and move, since they have absolute
1114
+ coordinates (unlike derwins) which lose their orientation. However, my
1115
+ scrollbar repainting is sucking since i need to paint it on the
1116
+ underlying window/subwin.
1117
+
1118
+ Somehow it prints a line 2 times - duh. Will have to see how far i can
1119
+ go with approach.
1120
+
1121
+ * * * * * * * *
1122
+
1123
+ Subject: splitpane nonbuffer change
1124
+ -----------------------------------
1125
+ Date: 2010-02-14 18:34
1126
+
1127
+ Due to removing buffers, now some methods that had relative coords such
1128
+ as hline and vline need absolute coordinate, by adding row and col
1129
+ respectively.
1130
+
1131
+ * * * * * * * *
1132
+
1133
+ Subject: giving up on splitpanes without buffers
1134
+ ------------------------------------------------
1135
+ Date: 2010-02-15 00:17
1136
+
1137
+ Okay, i am not having fun with subwindows. Too much existing code it has
1138
+ to work with.
1139
+
1140
+ Not having buffers at all is tough, since one can easily print outside
1141
+ the widget while moving it. Especially the boundaries.
1142
+
1143
+ So i might have to just go back to the dreaded buffered version. Only
1144
+ problem is going back to that version that worked perfectly except for
1145
+ the one condition in which a scrollpane was inside a splitpane, and only
1146
+ the cursor was a tad off.
1147
+
1148
+ Have to find that version!
1149
+
1150
+ * * * * * * * *
1151
+
1152
+ Subject: changed to SplitPane (rfed16 version)
1153
+ ----------------------------------------------
1154
+ Date: 2010-02-16 09:27
1155
+
1156
+ Currently, Splitpane was in a sorry state meaning mostly the values
1157
+ passed by higher functions for locating both the comps and their cursor
1158
+ values. Parameters passed were based on how things were working inside
1159
+ and it made no sense.
1160
+
1161
+ I've tried to make the parameters logical and sensible, and the inside
1162
+ functioning should work with those parameters rather than the other way
1163
+ round.
1164
+
1165
+ Similarly, width and height should also make sense in all cases.
1166
+ Somewhere values of row and col were relative, some places absolute.
1167
+
1168
+ Now in setrowcol of widget, i do not add ext_offsets. programs can add
1169
+ it.
1170
+
1171
+ RULE: All widgets should maintain absolute coordinates for row and col, even
1172
+ for internal objects. It is upto the Pad to remove @top and @left.
1173
+
1174
+ * * * * * * * *
1175
+
1176
+ Subject: changing width and height
1177
+ ----------------------------------
1178
+ Date: 2010-02-16 20:49
1179
+
1180
+ Wherever an object changes its childs dimensions, it should now also
1181
+ call `set_buffering` to update `:bottom` and `:right` (or :top and :left),
1182
+ since we are now using `buffer_to_window` in `Widget` which takes explicit
1183
+ values from this hash.
1184
+
1185
+ Earlier, `Pad` picked up values from the pad, and otherwin and then tried
1186
+ to make sense of what to use. Thus coincidentally some things worked,
1187
+ some did not.
1188
+
1189
+ Now that our wrapper for `copywin` does no magic, callers are forced to
1190
+ pass correct values, which means there is complete clarity into waht is
1191
+ happening at the callers end, the rules for printing a widget in complex
1192
+ circumstances is becoming clear and less random or coincidental.
1193
+
1194
+ * * * * * * * *
1195
+
1196
+ Subject: cursor positioning
1197
+ ---------------------------
1198
+ Date: 2010-02-17 00:25
1199
+
1200
+ I can't believe this. It seems I am not longer using ext_offsets any
1201
+ longer??
1202
+ I am setting the absolute coords of child components in scrollpane and
1203
+ splitpanes, which is kinda good, because its simple and no magic
1204
+ involved. No having 2 sets of coordinates around.
1205
+
1206
+ Also, it seems widgtes are using buffer_to_window, which also uses
1207
+ absolute coordinates for the screen.
1208
+
1209
+ Lastly, textview and textarea in set_form_row, don't use ext_offsets.
1210
+ They were earlier added in widget, later commented out to be added in
1211
+ indvidial programs. But everythings working without it, so i am free of
1212
+ one more hassle to look after.
1213
+
1214
+ * * * * * * * *
1215
+
1216
+ Subject: scrollpanes inside splitpanes
1217
+ --------------------------------------
1218
+ Date: 2010-02-17 10:14
1219
+
1220
+ The issue with placing a scrollpane a splitpane, esp in the second pane
1221
+ of a split.
1222
+ Currently, a SPLP sets its second components (C2's) row and col and
1223
+ other buffer parameters only after its divider has been set.
1224
+ Thus, when there is SPLP inside another SPLP, even the inner SPLP is
1225
+ able to inform its child of location when its divider is recomputed.
1226
+
1227
+ However, scrollpane informs its child of its location at the point of
1228
+ assignment. When the SCRP is the 2nd component in a SPLP, it doesn't yet
1229
+ have any row and col etc. When that is later updated, it currently has
1230
+ no means to update its child.
1231
+
1232
+ When SCRP's row and col are updated, or its set_buffering is called, it
1233
+ must further update the same for its child. Earlier that was not
1234
+ required since each pad was printing to a relative location.
1235
+
1236
+ * * * * * * * *
1237
+
1238
+ Subject: Now quite some success with splits and scrolls combined
1239
+ ----------------------------------------------------------------
1240
+ Date: 2010-02-17 14:38
1241
+
1242
+ with testsplit3a.rb working (**rfed16** branch), resizing etc is working fine,
1243
+ finally splitpanes and scrollpanes are in decent shape.
1244
+ There are still some programs not displaying okay .. 3b 3_1 -- have to
1245
+ see what's there.
1246
+
1247
+ Were those 2 ever working ? or was it only a cursor issue in them that
1248
+ wrecked everything and made me abandon rbcurse19 branch. I wonder how
1249
+ that branch is doing.
1250
+
1251
+ I think i need to start git tagging. Anyway, i am also taking snapshots.
1252
+ I need to start releasing gems or atleast tgz's on github.
1253
+
1254
+ * * * * * * * *
1255
+
1256
+ Subject: broken status
1257
+ ----------------------
1258
+ Date: 2010-02-17 22:23
1259
+
1260
+ Please note that consequent to the simplified buffering, and the way of
1261
+ calling it from containers the following are broken:
1262
+
1263
+ 1. listbox (e.g. testscrolllb.rb, testsplit3b.rb)
1264
+ 2. table
1265
+ 3. tabbedpane (container) (e.g. testtpane.rb)
1266
+
1267
+ Any program calling buffer_to_screen for a child is broken. The child
1268
+ now does a buffer_to_window using absolute coordinates.
1269
+
1270
+ Containers such as SplitPane and ScrollPane are now passing absolute row
1271
+ and col to child, and updating exact top, left, bottom and right.
1272
+
1273
+ I don't think children should be using ext_col_offset or ext_row_offset.
1274
+
1275
+ * * * * * * * *
1276
+
1277
+ Subject: splitpane = cascade changes is on (rfed16 branch)
1278
+ ----------------------------------------------------------
1279
+ Date: 2010-02-18 09:43
1280
+
1281
+ In RFED16, i've cut down on `Pad` usage, splitpanes and scrollpanes do not
1282
+ use pads themselves. Only the final object inserted in it such as a text
1283
+ are uses a Pad.
1284
+
1285
+ Thus there can be cropping issues when a splitpane or scrollpane writes
1286
+ outside the box. Thus, i switched on `cascade_changes` (which i had
1287
+ switched off). That's why there's no printing out of the boundary. That means
1288
+ that any change in the splitpane dimensions or resizing the split,
1289
+ causes the internal object to resize. Earlier they would not reduce,
1290
+ since cropping was happening.
1291
+
1292
+ Since there is no pad now, it is necessary that splitpane and scrollpane
1293
+ are never bigger than the splitpane they are on. I had earlier noted
1294
+ that `cascade_changes` defeats the purpose of a splitpane, however do not
1295
+ that the internal object is Pad based and can still exceed the
1296
+ `Splitpane` boundary.
1297
+
1298
+ Or rather. If you place a textarea in a splitpane, splitpane will resize
1299
+ the textarea (since `cascade_changes` in on). However, if you place a
1300
+ `Textarea` in a scrollpane, and the scrollpane inside a splitpane, then
1301
+ the `Textarea` is not resized. Only the object directly inside a splitpane
1302
+ is.
1303
+
1304
+ * * * * * * * *
1305
+
1306
+ Subject: More on splitpanes
1307
+ ---------------------------
1308
+ Date: 2010-02-18 20:08
1309
+
1310
+ Great news. I've got sample testsplit3_1.rb working which is an example
1311
+ with 2 splitpanes inside an outer splitpane.
1312
+ This exposed an issue, that since the second component's (right or
1313
+ bottom) coordinates are determined not when attached but only when the
1314
+ divider is set, therefore its too late for it to coomunicate that to
1315
+ some inner components.
1316
+
1317
+ Basically, if your second component is something other than another
1318
+ Splitpane, its okay. However, in this example, the second is a SplitPane
1319
+ for the first time, and it seems to get its parameters a bit too late.
1320
+
1321
+
1322
+ So before it repaints the children i update the locations. This is
1323
+ required even for the first since the first could be the first of the
1324
+ second - lol. Otherwise, both components on the right were printing at
1325
+ 0th column.
1326
+
1327
+ So there could be some more such missing cases, when i put the outer
1328
+ splitpane as horizontal. But hopefully earlier programs will not break
1329
+ since i am not touching existing paths.
1330
+
1331
+ I've still gotta fix TabbedPanes which are broken, I fixed Listboxes
1332
+ last night, but only lightly tested - surely there must be breaks
1333
+ somewhere.
1334
+ Also, gotta fix Tables. Things looking upbeat with the new "simpler
1335
+ approach" (see branch RFED16 of rbcurse).
1336
+
1337
+ * * * * * * * *
1338
+
1339
+ Subject: Fixed breakage in Table. Check testscrolltable.rb
1340
+ ----------------------------------------------------------
1341
+ Date: 2010-02-19 12:32
1342
+
1343
+ Done the tiny changes to `Table`. Working now.
1344
+ Also, `Scrollpane` increases size of child if child is smaller.
1345
+
1346
+ Now to fix `TabbedPanes`, more work involved here since each situation has
1347
+ to be taken care of in terms of sizing of child. However, hopefully will
1348
+ be simpler than `Splitpane`.
1349
+
1350
+ * * * * * * * *
1351
+
1352
+ Subject: scrollpane relevance in terminal apps
1353
+ ----------------------------------------------
1354
+ Date: 2010-02-22 20:38
1355
+
1356
+ Just wondering if scrollpanes have any meaning in a mouseless
1357
+ environment. The scrollbars have 3 functions:
1358
+
1359
+ 1. used to drag down. But for that they have to get focus.
1360
+ I don't make scrollbars focussable since that puts focus on too many
1361
+ objects. I've seen demos of some curses toolkits that did, besides
1362
+ being very low quality and buggy, focus was going to too many objects,
1363
+ it was irritating.
1364
+
1365
+ 2. show how much more of a document there is.
1366
+
1367
+ 3. presence of scrollbars indicates to user that he can scroll
1368
+ vertically or horizontally.
1369
+
1370
+ In a mouseless environment, no focus to scrollbar. Keys are used to
1371
+ scroll. However, we still need to indicate to user that he can scroll.
1372
+ Also user may want to know percentage of screen.
1373
+ On a terminal, scrollpanes are taking valuable rows and cols due to
1374
+ boundary and bars.
1375
+
1376
+ Since scrollbars result in added complexity especially wrt placement and
1377
+ cursor location, can we do away with scrollpanes as a widget and have
1378
+ them added onto other widgets.
1379
+ They would just place themselves where the object allows, on the objects
1380
+ own border. That eliminates a lot of testing.
1381
+
1382
+ scrolling can be an option to widgets. they then include this
1383
+ capability. Needs to be thought out, since Scrollpanes result in insdie
1384
+ object creating a buffer.
1385
+
1386
+ * * * * * * * *
1387
+
1388
+ Subject: double key mapping like vim
1389
+ ------------------------------------
1390
+ Date: 2010-02-24 15:17
1391
+
1392
+ The earlier Mapper than i had written was quite good, but integrating that to
1393
+ get multiple keys into rbcurse would have meant a lot of rework, and perhaps not have
1394
+ fitted in, with control going to multiple objects and heirarchies of
1395
+ objects, whereas Mapper takes over control.
1396
+
1397
+ So i've got a simple thing going, you can test out "gg" in any textview
1398
+ and it takes you to the start of the document.
1399
+
1400
+ Usually, we check for bindings after going through a case statement.
1401
+ This means if i've got a binding to "gg" on a listbox but listbox moves
1402
+ focus to first element with "g", my binding is never invoked.
1403
+
1404
+ One could do as follows:
1405
+ Make a call to process_key first, outside the case structure. If
1406
+ :UNHANDLED is returned, we go into case.
1407
+
1408
+ If the user presses, g once, but not a second time, return :UNHANDLED.
1409
+ if getch returns a -1, return UNHANDLED, not nil.
1410
+
1411
+ That way a double key binding can work, even with a single key binding.
1412
+ e.g. currently I have "jj" bound to ESC in Vim, but if i type any
1413
+ character other than j after a j or wait, then a j is typed.
1414
+
1415
+ So its a thought. In anycase, if the user wishes to override a binding,
1416
+ we should evaluate bindings first.
1417
+
1418
+ * * * * * * * *
1419
+
1420
+ Subject: regarding multiplier in embedded components
1421
+ ----------------------------------------------------
1422
+ Date: 2010-02-26 13:40
1423
+
1424
+ When i have a textarea inside a scrollpane, and i do C-u, who gets the
1425
+ numeric argument of 4 or 16, the scrollpane or textarea. Currently,
1426
+ since the scrollpane passes the key to textarea, so textarea increments
1427
+ multiplier.
1428
+ Then i press scroll (M-n), but the scrollpanes multiplier is still
1429
+ unset.
1430
+ This means that we cannot have a multiplier at an object level -- it
1431
+ must be a global app level thing. Each object uses the global arguments
1432
+ and resets after usage.
1433
+ But where do i trap the C-u key ??
1434
+
1435
+ * * * * * * * *
1436
+
1437
+ Subject: Undo in text widgets
1438
+ -----------------------------
1439
+ Date: 2010-03-06 10:09
1440
+
1441
+ 1. trap insert and delete events
1442
+ 2. keep a list of
1443
+ * row
1444
+ * curpos
1445
+ * string/char added or deleted
1446
+ * action: ADD or DEL
1447
+
1448
+ @current_position in list
1449
+
1450
+ 3. Undo() - moves up the list and does the opposite
1451
+ 4. Redo() - moves down the list and does the same action
1452
+
1453
+ * * * * * * * *
1454
+
1455
+ Subject: entry of string
1456
+ ------------------------
1457
+ Date: 2010-03-06 20:57
1458
+
1459
+ I've brought back entry of a string inside an application.
1460
+ Until now if one wanted to adhoc ask the user for a string (such as a
1461
+ search string), one used the dialogs. However, if one wishes to keep the
1462
+ "gui" to a minimum, `rbgetstr` (from module Io, io.rb) does the job.
1463
+
1464
+ It allows user to abort using `C-c`, or get specific help using `C-g`. Or
1465
+ use the arrow keys or backtab. However, i need to work in
1466
+ tab-completion, as well as perhaps history.
1467
+
1468
+ The main issue is coordinates to prompt. The widget often will not know
1469
+ where on the screen it should prompt. Dialog boxes solve this by opening
1470
+ their own window and then erasing it. Here to keep things simple, i just
1471
+ write on the form.window. The app should define the coordinates perhaps.
1472
+
1473
+ In the test, textview writes on its own lower border.
1474
+
1475
+ Perhaps, I'll bring back askyesno etc == for which currently the dialog
1476
+ box options exist.
1477
+
1478
+ * * * * * * * *
1479
+
1480
+ Subject: "most"-like menus
1481
+ --------------------------
1482
+ Date: 2010-03-06 21:03
1483
+
1484
+ For menu's we already have 2 ways:
1485
+
1486
+ 1. a menu bar just like the **Links** browser with sub options, hotkeys, actions etc.
1487
+ To see this press F2 in test2.rb.
1488
+
1489
+ 2. Popup-menus - Similar to the above, popup over a component to show
1490
+ its options. to see this, iirc the todo app example, if it still
1491
+ works.
1492
+
1493
+ 3. "Pine"-like option labels at the bottom of the screen. Absolutely
1494
+ identical -- check the rfe.rb example. This is usually for options
1495
+ that stay around forever. One can always superimpose another set when
1496
+ one wants, as moving into a component. This menu shows what's
1497
+ available, so usually in a data entry app, only control and alt-keys
1498
+ would be shown.
1499
+ This is only a display, and does not take over control or focus. It's
1500
+ like having a cheat-sheet of key-bindings at the bottom of the
1501
+ screen.
1502
+
1503
+ 4. I recently have been using most as a pager. It has a simple menu
1504
+ system available on pressing ":". I've copied it shamefully, so one
1505
+ can quickly set up multi-level menus with actions (procs or symbols)
1506
+ attached. The API may need work on. Since the location of this menu
1507
+ needs to be provided by application and not a widget. Currently,
1508
+ textview provides a location at 23,0.
1509
+ Unlike the pine-like labels, this prompts and takes control, so any
1510
+ letter can be defined per level.
1511
+ To see this, try any example with a textview and press "m" for menu.
1512
+ Try testsplit3.rb. I may change the mapping "m" shortly ?
1513
+
1514
+ So depending on the kind of application we have, we can choose the kind
1515
+ of menu system we want.
1516
+
1517
+ * * * * * * * *
1518
+
1519
+ Subject: undo facility - more on it
1520
+ -----------------------------------
1521
+ Date: 2010-03-08 18:09
1522
+
1523
+ currently the undo is independent of the textarea and uses the event
1524
+ object. however, it hardcodes access to the data structures of textarea.
1525
+
1526
+ Textarea should make an undo object and pass that. this object would
1527
+ have an undo and redo method which it has implemented. Also the object
1528
+ will maintain state of whether it can undo or redo. the undo object may
1529
+ have an array not just one value.
1530
+
1531
+ this way undo's can be clubbed. perhaps a block delete using a number
1532
+ can create an array of actions rather than separate actions. Hopefully,
1533
+ typing several chars can also be clubbed into one object to reduce
1534
+ memory.
1535
+
1536
+ * * * * * * * *