2

I am looking for hints/ideas for the best (most effective) way on how to scroll multi-line items as well as emphasizing of the "current item" and "selected items" such as:

1 FOO ITEM
  1 Foo sub-item
  2 Foo sub-item
  3 Foo sub-item

2 BAR ITEM
  1 Bar sub-item

3 BAZ ITEM
  1 Baz sub-item
  2 Baz sub-item

4 RAB ITEM

5 ZZZ ITEM
  1 Zzz sub-item
  2 Zzz sub-item
  3 Zzz sub-item
  4 Zzz sub-item

using NCurses (some combination of windows, sub-windows, pads, copywin? Uff! In fact, the lines could exceed the stdscr's width so that possibility to scroll left/right would be also nice - pads?)...

The whole items (including the sub-items) are supposed to be emphasized as full-width window/pad areas.

The "current item" (including it's set of lines) should be emphasized (i.e. using A_BOLD), selected set of items of choice (including the set of lines for each the selected item) should be emphasized in another way (i.e. using A_REVERSE).

What would you choose to cope with it the most effective NCurses way? (The less redrawals/refreshes the better and terminal is supposed to have the ability to change it's size - such as XTerm running under "floating window" management.)

Thank you for your ideas (or perhaps some piece of code where something similar is already solved - I was not able to find anything helpful on the Internet. I mean I am not going to copy/paste foreign code but programming NCurses properly is still somehow difficult to me).

P.S.: Would you suggest to "smooth-scroll" +1/-1 screen line or rather "jump-scroll" +lines/-lines of the items? (I personally prefer the latter one.)

Sincerely,

-- mjf

mjf
  • 141
  • 4
  • 1
    Don't sweat the optimizations. Ncurses will do all that is needed. Terminal emulators on today's computers are orders of magnitudes (literally) faster than dumb terminals running over 2400 baud lines. – BobDalgleish May 27 '14 at 01:11
  • @BobDalgleish from what I recall of my <96kbaud days, curses would change its control codes and data sent based on the baud rate. As you go up in speed (as in from 110 to 1200 baud), it changes from 'get the data there as fast as possible' to 'get the data there to represent the data the best for a human'. Trying to optimize for this lead to madness because curses did what was best anyways. –  May 27 '14 at 01:33
  • The "optimization" was rather to not call `doupdate()` all the time or so. If the design was to use subwins it could be slow in case of using small font, lot of items and running in XTerm fullscreen. Therefor I asked primarily for help with the NCurses design, i.e. what would be the best way to stack all the NCurses things (windows, pads) one over another to achieve smooth behaviour, even when resizing the terminal etc. (flickering can be so annoying). For instance, why to redraw content of an NCurses object just because of the emphasizing if one could just change the attributes and refresh()? – mjf May 27 '14 at 06:17

0 Answers0