From: <wda...@us...> - 2010-02-01 22:53:27
|
Revision: 5530 http://oorexx.svn.sourceforge.net/oorexx/?rev=5530&view=rev Author: wdashley Date: 2010-02-01 22:53:20 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Added some small edits and more tests. Modified Paths: -------------- incubator/orxcurses/Readme.txt incubator/orxcurses/ncurses.cls incubator/orxcurses/orxncurses.cpp Added Paths: ----------- incubator/orxcurses/test13-1.rex incubator/orxcurses/test13-2.rex incubator/orxcurses/test13-3.rex Modified: incubator/orxcurses/Readme.txt =================================================================== --- incubator/orxcurses/Readme.txt 2010-02-01 21:29:30 UTC (rev 5529) +++ incubator/orxcurses/Readme.txt 2010-02-01 22:53:20 UTC (rev 5530) @@ -21,7 +21,7 @@ ------------------ The OrxnCurses class library provides a mechanism to control whether or not indexes to rows, -columns, etc. are 0- or 1-based. By default all indexes are 1-based. I you wish to change +columns, etc. are 0- or 1-based. By default all indexes are 1-based. If you wish to change that you can invoke the SetBase class method as follows. .window~SetBase(0) -- changes all indexes to 0-based @@ -33,9 +33,10 @@ top of your code and leave it unchanged after that. Exceptions: these are values, not indexes (always 0-based): + attributes color numbers + soft label numbers soft label format numbers - attributes Provided Test Programs Modified: incubator/orxcurses/ncurses.cls =================================================================== --- incubator/orxcurses/ncurses.cls 2010-02-01 21:29:30 UTC (rev 5529) +++ incubator/orxcurses/ncurses.cls 2010-02-01 22:53:20 UTC (rev 5530) @@ -71,6 +71,37 @@ ::CONSTANT A_TOP 536870912 ::CONSTANT A_VERTICAL 1073741824 +-- mouse constants +::CONSTANT BUTTON1_RELEASED 1 +::CONSTANT BUTTON1_PRESSED 2 +::CONSTANT BUTTON1_CLICKED 4 +::CONSTANT BUTTON1_DOUBLE_CLICKED 8 +::CONSTANT BUTTON1_TRIPLE_CLICKED 16 +::CONSTANT BUTTON1_RESERVED_EVENT 32 +::CONSTANT BUTTON2_RELEASED 64 +::CONSTANT BUTTON2_PRESSED 128 +::CONSTANT BUTTON2_CLICKED 256 +::CONSTANT BUTTON2_DOUBLE_CLICKED 512 +::CONSTANT BUTTON2_TRIPLE_CLICKED 1024 +::CONSTANT BUTTON2_RESERVED_EVENT 2048 +::CONSTANT BUTTON3_RELEASED 4096 +::CONSTANT BUTTON3_PRESSED 8192 +::CONSTANT BUTTON3_CLICKED 16384 +::CONSTANT BUTTON3_DOUBLE_CLICKED 32768 +::CONSTANT BUTTON3_TRIPLE_CLICKED 65536 +::CONSTANT BUTTON3_RESERVED_EVENT 131072 +::CONSTANT BUTTON4_RELEASED 262144 +::CONSTANT BUTTON4_PRESSED 524288 +::CONSTANT BUTTON4_CLICKED 1048576 +::CONSTANT BUTTON4_DOUBLE_CLICKED 2097152 +::CONSTANT BUTTON4_TRIPLE_CLICKED 4194304 +::CONSTANT BUTTON4_RESERVED_EVENT 8388600 +::CONSTANT BUTTON_CTRL 16777216 +::CONSTANT BUTTON_SHIFT 33554432 +::CONSTANT BUTTON_ALT 61708864 +::CONSTANT ALL_MOUSE_EVENTS 134217727 +::CONSTANT REPORT_MOUSE_POSITION 134217728 + -- nCurses constants ::CONSTANT ERR -1 ::CONSTANT OK 0 @@ -172,6 +203,18 @@ ::CONSTANT KEY_F10 274 /* Function key */ ::CONSTANT KEY_F11 275 /* Function key */ ::CONSTANT KEY_F12 276 /* Function key */ +::CONSTANT KEY_F13 277 /* Function key */ +::CONSTANT KEY_F14 278 /* Function key */ +::CONSTANT KEY_F15 279 /* Function key */ +::CONSTANT KEY_F16 280 /* Function key */ +::CONSTANT KEY_F17 281 /* Function key */ +::CONSTANT KEY_F18 282 /* Function key */ +::CONSTANT KEY_F19 283 /* Function key */ +::CONSTANT KEY_F20 284 /* Function key */ +::CONSTANT KEY_F21 285 /* Function key */ +::CONSTANT KEY_F22 286 /* Function key */ +::CONSTANT KEY_F23 287 /* Function key */ +::CONSTANT KEY_F24 288 /* Function key */ ::CONSTANT KEY_DL 328 /* delete-line key */ ::CONSTANT KEY_IL 329 /* insert-line key */ ::CONSTANT KEY_DC 330 /* delete-character key */ @@ -271,7 +314,7 @@ ::METHOD slk_init public class EXTERNAL "LIBRARY orxncurses OrxCurSlk_init" ::METHOD init -if arg() = 0 & .window~stdscr() = 'STDSCR'then do +if .window~stdscr() = 'STDSCR' then do use strict arg self~first_init() .window~stdscr = self @@ -338,11 +381,11 @@ ptr = self~derwinprivate(nlines, ncols, begy, begx) return .window~new(ptr) ::METHOD derwinprivate private EXTERNAL "LIBRARY orxncurses OrxCurDerwinprivate" +::METHOD doupdate EXTERNAL "LIBRARY orxncurses OrxCurDoupdate" ::METHOD dupwin use strict arg ptr = self~dupwinprivate() return .window~new(ptr) -::METHOD doupdate EXTERNAL "LIBRARY orxncurses OrxCurDoupdate" ::METHOD dupwinprivate private EXTERNAL "LIBRARY orxncurses OrxCurDupwinprivate" ::METHOD echo EXTERNAL "LIBRARY orxncurses OrxCurEcho" ::METHOD noecho EXTERNAL "LIBRARY orxncurses OrxCurNoecho" @@ -359,7 +402,7 @@ ::METHOD mvgetch EXTERNAL "LIBRARY orxncurses OrxCurMvgetch" ::METHOD getmaxyx EXTERNAL "LIBRARY orxncurses OrxCurGetmaxyx" ::METHOD getparyx EXTERNAL "LIBRARY orxncurses OrxCurGetparyx" -::METHOD getmouseprivate EXTERNAL "LIBRARY orxncurses OrxCurGetmouseprivate" +::METHOD getmouseprivate private EXTERNAL "LIBRARY orxncurses OrxCurGetmouseprivate" ::METHOD getmouse ev = .Mevent~new() self~getmouseprivate(ev) @@ -543,8 +586,6 @@ ::class Pad public subclass Window -::METHOD newpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurNewpad" -::METHOD newsubpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurSubpadprivate" ::METHOD init if arg() = 2 then do use strict arg nlines, ncols @@ -556,16 +597,21 @@ end return +::METHOD newpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurNewpad" +::METHOD newsubpadprivate private EXTERNAL "LIBRARY orxncurses OrxCurSubpadprivate" + ::METHOD echochar return self~ERR ::METHOD mvwin return self~ERR ::METHOD pechochar EXTERNAL "LIBRARY orxncurses OrxCurPechochar" +-- TODO: Need to figure out why pnoutrefresh does not work --::METHOD pnoutrefresh EXTERNAL "LIBRARY orxncurses OrxCurPnoutrefresh" ::METHOD pnoutrefresh use strict arg minrow, mincol, sminrow, smincol, smaxrow, smaxcol .window~stdscr()~copywin(self, minrow, mincol, sminrow, smincol, smaxrow, smaxcol, .false) return self~OK +-- TODO: Need to figure out why prefresh does not work --::METHOD prefresh EXTERNAL "LIBRARY orxncurses OrxCurPrefresh" ::METHOD prefresh use strict arg minrow, mincol, sminrow, smincol, smaxrow, smaxcol Modified: incubator/orxcurses/orxncurses.cpp =================================================================== --- incubator/orxcurses/orxncurses.cpp 2010-02-01 21:29:30 UTC (rev 5529) +++ incubator/orxcurses/orxncurses.cpp 2010-02-01 22:53:20 UTC (rev 5530) @@ -3002,7 +3002,7 @@ } /** - * Method: OrxCnoutrefresh + * Method: OrxCurPnoutrefresh * * Refresh a pad. * Added: incubator/orxcurses/test13-1.rex =================================================================== --- incubator/orxcurses/test13-1.rex (rev 0) +++ incubator/orxcurses/test13-1.rex 2010-02-01 22:53:20 UTC (rev 5530) @@ -0,0 +1,70 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +numeric digits 12 +lf = '0A'x + +scr = .window~new() + +if scr~ncurses_mouse_version() > 0 then do + scr~addstr('This version of NCurses supports the mouse.' || lf) + end +else do + scr~addstr('This version of NCurses does not support the mouse.' || lf) + end + +mmask = scr~mousemask(scr~BUTTON3_CLICKED) +if mmask = scr~BUTTON3_CLICKED then do + scr~addstr('I am able to read a button 3 click.' || lf) + end +else do + scr~addstr('I am not able to read a button 3 click.' || lf) + end +scr~refresh() +ch = scr~getch() + +scr~endwin() +return + + +::requires 'ncurses.cls' + Property changes on: incubator/orxcurses/test13-1.rex ___________________________________________________________________ Added: svn:executable + * Added: incubator/orxcurses/test13-2.rex =================================================================== --- incubator/orxcurses/test13-2.rex (rev 0) +++ incubator/orxcurses/test13-2.rex 2010-02-01 22:53:20 UTC (rev 5530) @@ -0,0 +1,70 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +numeric digits 12 +lf = '0A'x + +scr = .window~new() + +if scr~ncurses_mouse_version() > 0 then do + scr~addstr('This version of NCurses supports the mouse.' || lf) + end +else do + scr~addstr('This version of NCurses does not support the mouse.' || lf) + end + +mmask = scr~mousemask(scr~ALL_MOUSE_EVENTS) +if mmask = 0 then do + scr~addstr('Unable to access the mouse on this terminal.' || lf) + end +else do + scr~addstr('Mouse events can be captured.' || lf) + end +scr~refresh() +ch = scr~getch() + +scr~endwin() +return + + +::requires 'ncurses.cls' + Added: incubator/orxcurses/test13-3.rex =================================================================== --- incubator/orxcurses/test13-3.rex (rev 0) +++ incubator/orxcurses/test13-3.rex 2010-02-01 22:53:20 UTC (rev 5530) @@ -0,0 +1,69 @@ +#!/usr/bin/rexx +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2010 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Authors; */ +/* W. David Ashley <da...@us...> */ +/* */ +/*----------------------------------------------------------------------------*/ + + +numeric digits 12 +lf = '0A'x + +scr = .window~new() +scr~noecho() +scr~keypad(.true) + +mmask = scr~mousemask(scr~ALL_MOUSE_EVENTS) + +do forever + ch = scr~getch() + if ch = scr~KEY_MOUSE then do + mort = scr~getmouse() + scr~move(1, 1) + scr~clrtoeol() + scr~addstr(mort~y || '/' || mort~x) + scr~refresh() + end + if ch = lf then leave + end + +scr~endwin() +return + + +::requires 'ncurses.cls' + Property changes on: incubator/orxcurses/test13-3.rex ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |