2012-04-20 22:40:56 +02:00
|
|
|
/*
|
|
|
|
* c_screen.c - gb.ncurses Screen class
|
|
|
|
*
|
2013-02-10 21:06:36 +01:00
|
|
|
* Copyright (C) 2012/3 Tobias Boege <tobias@gambas-buch.de>
|
2012-04-20 22:40:56 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define __C_SCREEN_C
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <signal.h>
|
2013-02-10 21:06:36 +01:00
|
|
|
#include <assert.h>
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
#include <ncurses.h>
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
#include <panel.h>
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
#include "gambas.h"
|
|
|
|
|
|
|
|
#include "main.h"
|
2012-06-13 17:47:00 +02:00
|
|
|
#include "c_screen.h"
|
|
|
|
#include "c_input.h"
|
2012-04-20 22:40:56 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
#define THIS _active
|
2012-04-20 22:40:56 +02:00
|
|
|
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
#define E_UNSUPP "Unsupported value"
|
2012-04-20 22:40:56 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
static CSCREEN *_active;
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2012-06-13 17:47:00 +02:00
|
|
|
GB_SIGNAL_CALLBACK *_sigwinch_cb;
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2012-04-20 22:40:56 +02:00
|
|
|
DECLARE_EVENT(EVENT_Resize);
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
static void SCREEN_sigwinch(int signum, intptr_t data)
|
2012-04-20 22:40:56 +02:00
|
|
|
{
|
2013-02-10 21:06:36 +01:00
|
|
|
/* TODO: ncurses may be configured to provide its own SIGWINCH
|
|
|
|
* handler. See resizeterm(3X). */
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
if (signum == SIGWINCH)
|
2013-02-10 21:06:36 +01:00
|
|
|
GB.Raise(_active, EVENT_Resize, 0);
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
}
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
int SCREEN_init()
|
|
|
|
{
|
2013-02-10 21:06:36 +01:00
|
|
|
_sigwinch_cb = GB.Signal.Register(SIGWINCH, SCREEN_sigwinch,
|
|
|
|
(intptr_t) NULL);
|
2012-04-20 22:40:56 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
void SCREEN_exit()
|
|
|
|
{
|
2013-02-10 21:06:36 +01:00
|
|
|
GB.Signal.Unregister(SIGWINCH, _sigwinch_cb);
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
}
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
void SCREEN_refresh()
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
{
|
|
|
|
if (!NCURSES_RUNNING)
|
|
|
|
return;
|
|
|
|
update_panels();
|
|
|
|
doupdate();
|
|
|
|
}
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
BEGIN_METHOD_VOID(Screen_init)
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
_active = GB.AutoCreate(GB.FindClass("Screen"), 0);
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
END_METHOD
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2014-02-04 20:42:05 +01:00
|
|
|
static int CSCREEN_cursor(CSCREEN *scr, int mode)
|
|
|
|
{
|
|
|
|
if (mode >= 0 && mode <= 2)
|
|
|
|
curs_set(mode);
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
scr->cursor = mode;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CSCREEN_echo(CSCREEN *scr, int mode)
|
|
|
|
{
|
|
|
|
if (mode)
|
|
|
|
echo();
|
|
|
|
else
|
|
|
|
noecho();
|
|
|
|
scr->echo = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(Screen_new)
|
|
|
|
|
|
|
|
CSCREEN_cursor(THIS, 1);
|
|
|
|
CSCREEN_echo(THIS, 1);
|
|
|
|
INPUT_mode(THIS, INPUT_CBREAK);
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
#if 0
|
|
|
|
BEGIN_METHOD(Screen_new, GB_STRING termpath)
|
2012-06-13 17:47:00 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
char path[LENGTH(termpath) + 1];
|
|
|
|
FILE *finout;
|
2012-06-13 17:47:00 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
strncpy(path, STRING(termpath), LENGTH(termpath));
|
|
|
|
path[LENGTH(termpath)] = 0;
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
finout = fopen(path, "r+");
|
|
|
|
if (!finout) {
|
|
|
|
GB.Error(NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
assert(_maxscreen < MAX_SCREENS);
|
|
|
|
_screens[_maxscreen] = THIS;
|
|
|
|
THIS->index = _curscreen = _maxscreen++;
|
|
|
|
THIS->screen = newterm(NULL, finout, finout);
|
|
|
|
set_term(THIS->screen);
|
|
|
|
THIS->finout = finout;
|
|
|
|
THIS->buffered = 1;
|
|
|
|
CSCREEN_cursor(THIS, 0);
|
|
|
|
CSCREEN_echo(THIS, 0);
|
|
|
|
INPUT_mode(THIS, INPUT_CBREAK);
|
|
|
|
refresh();
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(Screen_free)
|
|
|
|
|
|
|
|
void *dst, *src;
|
|
|
|
|
|
|
|
if (THIS->index != _maxscreen - 1) {
|
|
|
|
dst = &_screens[THIS->index];
|
|
|
|
src = dst + sizeof(_screens[0]);
|
|
|
|
memmove(dst, src, _maxscreen - THIS->index);
|
|
|
|
}
|
|
|
|
_screens[THIS->index] = NULL;
|
|
|
|
if (_curscreen)
|
|
|
|
_curscreen--;
|
|
|
|
_maxscreen--;
|
|
|
|
endwin();
|
|
|
|
fclose(THIS->finout);
|
|
|
|
delscreen(THIS->screen);
|
|
|
|
if (!_maxscreen) {
|
|
|
|
SCREEN_exit();
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-02-10 21:06:36 +01:00
|
|
|
set_term(_active->screen);
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
END_METHOD
|
|
|
|
#endif
|
|
|
|
|
2015-07-29 21:32:45 +02:00
|
|
|
BEGIN_METHOD_VOID(Screen_Beep)
|
|
|
|
|
|
|
|
beep();
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(Screen_Flash)
|
|
|
|
|
|
|
|
flash();
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
BEGIN_METHOD_VOID(Screen_Refresh)
|
|
|
|
|
|
|
|
SCREEN_refresh();
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD(Screen_Resize, GB_INTEGER lines; GB_INTEGER cols)
|
|
|
|
|
|
|
|
resizeterm(VARG(lines), VARG(cols));
|
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
GB_DESC CCursorDesc[] = {
|
|
|
|
GB_DECLARE("Cursor", 0),
|
|
|
|
GB_NOT_CREATABLE(),
|
|
|
|
|
|
|
|
/* According to curs_set */
|
|
|
|
GB_CONSTANT("Hidden", "i", 0),
|
|
|
|
GB_CONSTANT("Visible", "i", 1),
|
|
|
|
GB_CONSTANT("VeryVisible", "i", 2),
|
|
|
|
|
|
|
|
GB_END_DECLARE
|
|
|
|
};
|
|
|
|
|
2012-04-20 22:40:56 +02:00
|
|
|
BEGIN_PROPERTY(Screen_Cursor)
|
|
|
|
|
2012-04-30 22:31:35 +02:00
|
|
|
if (READ_PROPERTY) {
|
2013-02-10 21:06:36 +01:00
|
|
|
GB.ReturnInteger(THIS->cursor);
|
2012-04-20 22:40:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
if (CSCREEN_cursor(THIS, VPROP(GB_INTEGER)) == -1)
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
GB.Error(E_UNSUPP);
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(Screen_Echo)
|
|
|
|
|
|
|
|
if (READ_PROPERTY) {
|
2013-02-10 21:06:36 +01:00
|
|
|
GB.ReturnBoolean(THIS->echo);
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
return;
|
2012-04-20 22:40:56 +02:00
|
|
|
}
|
2013-02-10 21:06:36 +01:00
|
|
|
CSCREEN_echo(THIS, !!VPROP(GB_BOOLEAN));
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(Screen_Input)
|
|
|
|
|
2012-04-30 22:31:35 +02:00
|
|
|
if (READ_PROPERTY) {
|
2013-02-10 21:06:36 +01:00
|
|
|
GB.ReturnInteger(THIS->input);
|
2012-04-20 22:40:56 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-02-10 21:06:36 +01:00
|
|
|
INPUT_mode(THIS, VPROP(GB_INTEGER));
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
2012-04-20 22:40:56 +02:00
|
|
|
BEGIN_PROPERTY(Screen_Lines)
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
if (READ_PROPERTY) {
|
|
|
|
GB.ReturnInteger(LINES);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
resizeterm(VPROP(GB_INTEGER), COLS);
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(Screen_Cols)
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
if (READ_PROPERTY) {
|
|
|
|
GB.ReturnInteger(COLS);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
resizeterm(LINES, VPROP(GB_INTEGER));
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
2012-06-13 17:47:00 +02:00
|
|
|
GB_DESC CScreenDesc[] = {
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
GB_DECLARE("Screen", sizeof(CSCREEN)),
|
2012-04-20 22:40:56 +02:00
|
|
|
GB_AUTO_CREATABLE(),
|
2013-02-10 21:06:36 +01:00
|
|
|
GB_NOT_CREATABLE(),
|
2012-04-20 22:40:56 +02:00
|
|
|
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
GB_EVENT("Resize", NULL, NULL, &EVENT_Resize),
|
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
GB_STATIC_METHOD("_init", NULL, Screen_init, NULL),
|
2015-07-29 21:32:45 +02:00
|
|
|
GB_STATIC_METHOD("Beep", NULL, Screen_Beep, NULL),
|
|
|
|
GB_STATIC_METHOD("Flash", NULL, Screen_Flash, NULL),
|
2013-02-10 21:06:36 +01:00
|
|
|
GB_STATIC_METHOD("Refresh", NULL, Screen_Refresh, NULL),
|
2013-05-12 16:59:07 +02:00
|
|
|
GB_STATIC_METHOD("Resize", NULL, Screen_Resize, "(Lines)i(Cols)i"),
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
GB_STATIC_PROPERTY("Cursor", "i", Screen_Cursor),
|
|
|
|
GB_STATIC_PROPERTY("Echo", "b", Screen_Echo),
|
[GB.NCURSES]
* NEW: Move .Buffered and .Refresh() from Window to Screen class as Screen
reflects better that these routines affect the entire screen
* NEW: Window has a Caption property to display a caption within the border
frame; only visible when the Window has a border
* NEW: Add NoDelay input mode to Screen class (for use with caution and a
true tty). This mode lets the programmer artifically set the keyboard
repeat delay for the program (beware: still broken)
* NEW: Add IsConsole property to check if one can enter NoDelay mode
* NEW: Add Repeater property to Screen to specify keyboard repeat
delay. This specifies the minimum interval of sucessively risen Read
events and Window.Read() calls
* NEW: Rename Window.WaitKey() to .Read()
* NEW: Rename Window.Bottom() to .Lower() and .Top() to .Raise()
* NEW: Add very-visible mode for cursor, according to ncurses doc
* NEW: Window class has a new optional parameter to specify the parent
Screen, if none given, the currently active Screen is used.
* NEW: Window class does not get a default event name anymore. If the Read
event is risen and the active Window cannot raise events, the parent
Screen raises it (beware: still broken)
* NEW: Window.Border is an integer, new constants .None, .ASCII, .ACS to
choose the border look
* NEW: Cursor resides on the new location after Window.Print() now
* OPT: Remove redundant wrapping code in Print function because ncurses
waddch() does this by itself
* OPT: Stream inheritance entirely useless due to future ReadLine()
function, hence it was removed
* OPT: Remove NCurses class, it contained only component-global routines
that were moved to main module
* BUG: Turning off attributes with the Normal attribute now works
* BUG: Changes on color attributes (also on color pairs) are immediately
visible now
* BUG: Fix string argument handling in Window.Ask(), .Insert(), .Print() and
.PrintCenter()
* BUG: Newline to Window.Print() really works now and gives the desired
effect of not returning to x=0 on the next line (like ncurses does)
git-svn-id: svn://localhost/gambas/trunk@4778 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-25 23:09:17 +02:00
|
|
|
GB_STATIC_PROPERTY("Input", "i", Screen_Input),
|
2012-04-20 22:40:56 +02:00
|
|
|
|
2013-02-10 21:06:36 +01:00
|
|
|
GB_STATIC_PROPERTY("Height", "i", Screen_Lines),
|
|
|
|
GB_STATIC_PROPERTY("H", "i", Screen_Lines),
|
|
|
|
GB_STATIC_PROPERTY("Width", "i", Screen_Cols),
|
|
|
|
GB_STATIC_PROPERTY("W", "i", Screen_Cols),
|
2012-04-20 22:40:56 +02:00
|
|
|
|
|
|
|
GB_END_DECLARE
|
|
|
|
};
|