[Gambas-devel] Fwd: Re: gb.ncurses feedback?

Benoît Minisini gambas at ...1...
Sat Apr 14 11:14:43 CEST 2012


Le 14/04/2012 10:53, tobi a écrit :
>
> D'accord with the NCurses.On() and .Off(), they will be removed (see
> manpage for endwin() for the refresh() thing). With the signal
> handler as well. And so there shall only be a warning regarding
> Application_Read() in ncurses programs somewhere.

An explanation in the documentation will be enough I think. And it's
logical: if you use NCurses, you should let him handle the input.

>
> Being new to svn, the only way out for me was to get a fresh copy - I
> just haven't seen anything in the code I had on my disk regarding
> conflicts, which I could have solved manually then. (Will visit the
> documentation which doesn't appear to reside in its manpages). I'll
> try to incorporate all the suggestions.

In the Gambas wiki I wrote a little documentation about subversion and
how to handle conflicts. Did you read it?

> One word about the naming of internal functions and variables... I
> have to problem to rename my functions or yours but I just can't
> stand two different naming schemes in an integral piece of code ;)
> What'd be the way to go?

Alas you will find two different conventions in the source code. IMHO
the better is the more recent one:

1) Implementation functions are named "<Class>_<Symbol>", respecting the
case. For example, 'NCurses_Cursor' (and not 'CNCurses_cursor' anymore).
For special methods ('_new', '_free'...), use '<Class>_new',
'<Class>_free'...

2) Global functions are named starting with a module name in uppercase,
and an underscore: 'NCURSES_init' for example. It could have been
'CNURSES_init' if you use the file name as module name.

Beware that arguments in symbol signature must follow the "Pascal"
convention (i.e. start with an uppercase character). So, for example:

	GB_METHOD("_new", NULL, Window_new, "(X)i(Y)i(W)i(H)i"),

instead of:

	GB_METHOD("_new", NULL, CWindow_new, "(x)i(y)i(w)i(h)i"),


>
> For my Pong, I added the following: * Window.Refresh(): Refreshes the
> screen (rationale: s.b.)

Does it refresh the window or the full screen?

> * Window.Buffered: Whether calls to REFRESH() shall produce any
> output on the physical screen. If set, they won't and the user has to
> use Window.Refresh(), as one would do C ncurses (rationale: in games,
> such as Pong, one may redraw several items after each other in
> shorter time intervals. With my terminal (180*75) this is a rather
> flickering concern, so during this redraw routine one may buffer
> one's changes and plot to screen once at the end - works beautifully
> with that solution)

Seems rational.

> * Window.Ask(): Gets a string consisting of characters to accept and
> optionally a @tries variable. When one of the given characters was
> typed or the tries exceeded, the function will return (Null if
> exceeded, otherwise a string containing the typed choice) (rationale:
> saves While loops when the programmer only wants to accept certain
> keys)

Strange, but why not?

> * Window.PrintCenter(): Takes a string and places it vertically
> centered (the whole string. which means that the middle line of the
> string shall be the closest to the middle of the screen) and
> horizontally (line by line. means that the middle character of each
> line is the closest to the horizontal centre of the screen)
> (rational: looks good for initial prompts (it's the way, I used it
> however))

Mmfff. You should let a little work to the user. :-)

>
> The reason for that I'm telling you now is to leave you a chance to
> improve their names while I'm typing - which seems to be most true
> for the latter two ;)
>
> I was also experimenting with the Timer object. Before I continue:
> May it be worth to have a Redraw event, generated by a
> window-internal timer (a Redraw property according)? The same thing
> can, of course, be accomplished by having a timer in the application
> and I did that, works. It would be a pure feature reducing
> application source code variables.

Why not? But same remark. Making the timer in Gambas is not a lot of
lines of code.

Waiting for your commit...

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list