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

Benoît Minisini gambas at ...1...
Sat Apr 14 00:35:00 CEST 2012


Le 14/04/2012 00:24, Benoît Minisini a écrit :
>
>
> -------- Message original --------
> Sujet: Re: gb.ncurses feedback?
> Date : Sat, 14 Apr 2012 00:21:43 +0200
> De : Benoît Minisini<gambas at ...1...>
> Pour : tobi<tobias at ...692...>
>
> Le 13/04/2012 23:44, tobi a écrit :
>> Hi Benoît,
>>
>> still collecting bugs? ;)
>> Since you wanted to inspect the code, am I to expect a short feedback (an "OK" would do in the
>> best case)?
>> Writing an application to demonstrate the Window class I felt that the class needs some more stuff,
>> so it was extended and it's really time to know if it is well enough coded to continue or rewrite.
>>
>> Regards,
>> Tobi
>>
>>
>
> I have just committed some little changes:
>
> - I centralize the NCurses initialization and uninitialization in two
> routines.
>
> - I replaced the REFRESH() macro by a function that checks that the
> library has not been unitialized. Otherwise calling NCurses refresh
> routines after endwin() does strange things to the terminal.
>
> - I added an interpreter "error hook" that calls endwin(), so that the
> error message is printed by the interpreter on a clean terminal.
>
> So that you can install the SIGWINCH signal correctly, I will add to the
> interpreter API the needed calls to the interpreter routines that will
> do that for you.
>
> Then you will need to create a pipe. The signal handler will write to
> the pipe, and you will watch the pipe output and raise event from there.
>
> Only an object can raise event. I think the Window object that is
> actually the screen will raise the Resize event when the SIGWINCH signal
> is received.
>
> If you want a window to raise a Read event when a key is pressed, you
> just have to watch the standard input *once*, and then send the event
> from the currently focused window. You don't need to change the watch
> callback!
>
> Beware that the standard input is automatically watched by the
> interpreter if the user defined a global Application_Read function in
> the startup class. Your callback will replace it, and the
> Application_Read function will never be called.
>
> I will have other remarks about the function and properties name for
> sure! :-)
>
> Regards,
>

- I don't understand the Window array accessors. I suggest that you keep 
the array accessors for accessing character attributes individually, and 
that you create methods for retrieving some text blocks.

- I suggest that you rename the following methods:

Window.HLine() -> Window.DrawHLine()
Window.VLine() -> Window.DrawVLine()

And then, the cool thing would be having a Window.DrawRect() that can 
draw overlapping rects and manage the character appearance when lines 
cross. :-)

- I think that NCurses should be initialized by default in the main 
hook, just before the Main() function is called.

- NCurses.On() and NCurses.Off() should be removed. Or renamed if we 
need to exit the ncurses mode temporarily.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list