├── extraParams.hxml
├── lib
├── docs
│ ├── CNAME
│ ├── mkman.sh
│ ├── manext.awk
│ └── README.md
├── sdl2
│ ├── versions.mif
│ ├── pdcutil.c
│ ├── pdcgetsc.c
│ ├── pdcsdl.h
│ ├── sdltest.c
│ ├── pdcclip.c
│ ├── pdcsetsc.c
│ ├── Makefile.vc
│ └── Makefile
├── common
│ ├── README.md
│ ├── borland.lrf
│ ├── pdcurses.rc
│ ├── libobjs.mif
│ ├── acsuni.h
│ ├── acsgr.h
│ ├── acs437.h
│ ├── iconbmp.h
│ ├── icon32.xpm
│ └── watcom.mif
├── sdl1
│ ├── pdcutil.c
│ ├── pdcgetsc.c
│ ├── pdcsdl.h
│ ├── sdltest.c
│ ├── Makefile
│ ├── pdcsetsc.c
│ └── pdcclip.c
├── wincon
│ ├── pdcutil.c
│ ├── pdcwin.h
│ ├── Makefile.wcc
│ ├── pdcgetsc.c
│ ├── Makefile.bcc
│ ├── Makefile
│ ├── README.md
│ ├── Makefile.vc
│ ├── pdcsetsc.c
│ └── pdcclip.c
├── os2
│ ├── pdcos2.h
│ ├── Makefile.wcc
│ ├── pdcutil.c
│ ├── README.md
│ ├── pdcgetsc.c
│ ├── Makefile.bcc
│ ├── Makefile
│ ├── pdcsetsc.c
│ └── pdcdisp.c
├── x11
│ ├── pdcgetsc.c
│ ├── pdcutil.c
│ ├── config.h.in
│ ├── scrlbox.h
│ ├── xcurses-config.in
│ ├── pdcx11.h
│ └── pdcsetsc.c
├── pdcurses
│ ├── README.md
│ ├── beep.c
│ ├── move.c
│ ├── delch.c
│ ├── scroll.c
│ ├── debug.c
│ ├── inch.c
│ ├── printw.c
│ ├── clear.c
│ └── getyx.c
├── dos
│ ├── Makefile.wcc
│ ├── README.md
│ ├── Makefile.bcc
│ ├── pdcgetsc.c
│ ├── Makefile
│ ├── pdcutil.c
│ ├── pdcsetsc.c
│ ├── pdcclip.c
│ └── pdcdisp.c
├── demos
│ ├── README.md
│ ├── nctests.mif
│ ├── ncurses_cfg.h
│ ├── tui.h
│ └── firework.c
├── panel.h
├── README.md
└── curspriv.h
├── .github
├── FUNDING.yml
├── images
│ └── screen.png
└── ISSUE_TEMPLATE.md
├── haxe
└── ui
│ └── backend
│ ├── EventImpl.hx
│ ├── pdcurses
│ ├── _module
│ │ └── styles
│ │ │ ├── dark
│ │ │ └── main.css
│ │ │ ├── main.css
│ │ │ └── default
│ │ │ ├── main.css
│ │ │ ├── textinputs.css
│ │ │ ├── ranges.css
│ │ │ ├── sidebars.css
│ │ │ ├── frames.css
│ │ │ ├── buttons.css
│ │ │ ├── sliders.css
│ │ │ ├── progressbars.css
│ │ │ ├── splitters.css
│ │ │ ├── checkboxes.css
│ │ │ ├── tableviews.css
│ │ │ ├── listviews.css
│ │ │ ├── tabs.css
│ │ │ ├── scrollviews.css
│ │ │ ├── dropdowns.css
│ │ │ ├── menus.css
│ │ │ ├── scrollbars.css
│ │ │ ├── dialogs.css
│ │ │ └── steppers.css
│ ├── lib
│ │ ├── WINDOW.hx
│ │ ├── MEVENT.hx
│ │ └── Keys.hx
│ ├── Mouse.hx
│ ├── Keyboard.hx
│ ├── BorderTypes.hx
│ ├── Chars.hx
│ ├── ppm
│ │ └── PPMImage.hx
│ └── Image.hx
│ ├── ImageData.hx
│ ├── TextInputImpl.hx
│ ├── FontData.hx
│ ├── ImageSurface.hx
│ ├── ComponentGraphicsImpl.hx
│ ├── ComponentSurface.hx
│ ├── BackendImpl.hx
│ ├── ToolkitOptions.hx
│ ├── CallLaterImpl.hx
│ ├── PlatformImpl.hx
│ ├── ImageDisplayImpl.hx
│ ├── AppImpl.hx
│ ├── TimerImpl.hx
│ ├── AssetsImpl.hx
│ ├── module.xml
│ └── TextDisplayImpl.hx
├── README.md
├── haxelib.json
└── LICENSE.md
/extraParams.hxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/docs/CNAME:
--------------------------------------------------------------------------------
1 | pdcurses.org
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [ianharrigan]
2 | patreon: haxeui
3 |
--------------------------------------------------------------------------------
/lib/sdl2/versions.mif:
--------------------------------------------------------------------------------
1 | SDLBASE = C:\SDL2-2.0.10
2 | TTFBASE = C:\SDL2_ttf-2.0.15
3 |
--------------------------------------------------------------------------------
/haxe/ui/backend/EventImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class EventImpl extends EventBase {
4 | }
--------------------------------------------------------------------------------
/.github/images/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/haxeui/haxeui-pdcurses/HEAD/.github/images/screen.png
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/dark/main.css:
--------------------------------------------------------------------------------
1 | .default-background {
2 | background-color: black;
3 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ImageData.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | typedef ImageData = haxe.ui.backend.pdcurses.ppm.PPMImage;
--------------------------------------------------------------------------------
/haxe/ui/backend/TextInputImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class TextInputImpl extends TextDisplayImpl {
4 | }
5 |
--------------------------------------------------------------------------------
/haxe/ui/backend/FontData.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class FontData {
4 | public function new() {
5 | }
6 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ImageSurface.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class ImageSurface {
4 | public function new() {
5 | }
6 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ComponentGraphicsImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class ComponentGraphicsImpl extends ComponentGraphicsBase {
4 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ComponentSurface.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class ComponentSurface {
4 | public function new() {
5 | }
6 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/BackendImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class BackendImpl {
4 | public static var id:String = "pdcurses";
5 | }
6 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/lib/WINDOW.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses.lib;
2 |
3 | //@:include("Options.h")
4 | @:struct
5 | @:native("WINDOW")
6 | extern class WINDOW {
7 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ToolkitOptions.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | import haxe.ui.backend.pdcurses.CursesApp;
4 |
5 | typedef ToolkitOptions = {
6 | ?app:CursesApp
7 | }
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # haxeui-pdcurses
2 | pdcurses text only backend for haxeui
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/main.css:
--------------------------------------------------------------------------------
1 | .box, .hbox {
2 | spacing: 1px;
3 | }
4 |
5 | .vbox {
6 | vertical-spacing: 0px;
7 | }
8 |
9 | .grid {
10 | vertical-spacing: 0;
11 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/CallLaterImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class CallLaterImpl {
4 | private static var _fns:ArrayVoid> = [];
5 |
6 | public function new(fn:Void->Void) {
7 | _fns.push(fn);
8 | }
9 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/main.css:
--------------------------------------------------------------------------------
1 | .default-background {
2 | background-color: white;
3 | }
4 |
5 | .image {
6 | color: #000000;
7 | }
8 |
9 | .label {
10 | background-color: none;
11 | color: #000080;
12 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/textinputs.css:
--------------------------------------------------------------------------------
1 | .textfield {
2 | border: 1px single #000088;
3 | background-color: none;
4 | initial-width: 20px;
5 | filter: none;
6 | height: 3px;
7 | padding: 1px;
8 | color: #000000;
9 | }
10 |
--------------------------------------------------------------------------------
/lib/docs/mkman.sh:
--------------------------------------------------------------------------------
1 | echo Definitions and Variables \(curses.h\) > MANUAL.md
2 | echo ==================================== >> MANUAL.md
3 | ./manext.awk ../curses.h >> MANUAL.md
4 | echo Functions >> MANUAL.md
5 | echo ========= >> MANUAL.md
6 | ./manext.awk ../pdcurses/*.c >> MANUAL.md
7 | ./manext.awk ../x11/*.c >> MANUAL.md
8 |
--------------------------------------------------------------------------------
/lib/common/README.md:
--------------------------------------------------------------------------------
1 | PDCurses common files
2 | =====================
3 |
4 | This directory is for files which are platform-specific, yet shared by
5 | more than one platform, in contrast to the "common core" in ../pdcurses.
6 |
7 |
8 | Distribution Status
9 | -------------------
10 |
11 | The files in this directory are released to the public domain.
12 |
--------------------------------------------------------------------------------
/lib/docs/manext.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 | BEGIN {
3 | inman=0;
4 | bar="\n\n--------------------------------------------------------------------------\n";
5 | }
6 | {
7 | if (inman) {
8 | if ($0 ~ /^\*\*man-end/) {
9 | inman=0;
10 | print bar;
11 | } else
12 | print;
13 | } else if ($0 ~ /^\/\*man-start\*/)
14 | inman=1;
15 | }
16 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/ranges.css:
--------------------------------------------------------------------------------
1 | .range {
2 | color: #888888;
3 | border: none;
4 | padding: 0;
5 | background-image: 'CKBOARD'
6 | }
7 |
8 | .range-value {
9 | background-color: #000088;
10 | border: none;
11 | }
12 |
13 | .range {
14 | filter: none;
15 | background-image: 'CKBOARD';
16 | background-color: #FFFFFF;
17 | color: #000080;
18 | border: none;
19 | __height: 5px;
20 | }
21 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/lib/MEVENT.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses.lib;
2 |
3 | import cpp.RawPointer;
4 |
5 | @:include("curses.h")
6 | @:struct
7 | @:native("MEVENT")
8 | extern class MEVENT {
9 | public var id:Int;
10 | public var x:Int;
11 | public var y:Int;
12 | public var z:Int;
13 | public var bstate:Int;
14 |
15 | @:native("new MEVENT") public static function create():RawPointer;
16 | }
17 |
--------------------------------------------------------------------------------
/lib/sdl2/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | void PDC_beep(void)
6 | {
7 | PDC_LOG(("PDC_beep() - called\n"));
8 | }
9 |
10 | void PDC_napms(int ms)
11 | {
12 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
13 |
14 | while (ms > 50)
15 | {
16 | PDC_pump_and_peep();
17 | SDL_Delay(50);
18 | ms -= 50;
19 | }
20 | PDC_pump_and_peep();
21 | SDL_Delay(ms);
22 | }
23 |
24 | const char *PDC_sysname(void)
25 | {
26 | return "SDL2";
27 | }
28 |
--------------------------------------------------------------------------------
/haxelib.json:
--------------------------------------------------------------------------------
1 | {
2 | "contributors": [
3 | "haxeui",
4 | "ianharrigan"
5 | ],
6 | "version": "1.7.0",
7 | "dependencies": {
8 | "haxeui-core": ""
9 | },
10 | "releasenote": "1.7.0 release",
11 | "tags": [
12 | "ui",
13 | "gui",
14 | "pdcurses"
15 | ],
16 | "license": "MIT",
17 | "name": "haxeui-pdcurses",
18 | "description": "The pdcurses backend of the HaxeUI framework",
19 | "url": "https://github.com/haxeui/haxeui-pdcurses"
20 | }
--------------------------------------------------------------------------------
/lib/sdl1/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | void PDC_beep(void)
6 | {
7 | PDC_LOG(("PDC_beep() - called\n"));
8 | }
9 |
10 | void PDC_napms(int ms)
11 | {
12 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
13 |
14 | PDC_update_rects();
15 | while (ms > 50)
16 | {
17 | SDL_PumpEvents();
18 | SDL_Delay(50);
19 | ms -= 50;
20 | }
21 | SDL_PumpEvents();
22 | SDL_Delay(ms);
23 | }
24 |
25 | const char *PDC_sysname(void)
26 | {
27 | return "SDL";
28 | }
29 |
--------------------------------------------------------------------------------
/lib/wincon/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcwin.h"
4 |
5 | void PDC_beep(void)
6 | {
7 | PDC_LOG(("PDC_beep() - called\n"));
8 |
9 | /* MessageBeep(MB_OK); */
10 | MessageBeep(0XFFFFFFFF);
11 | }
12 |
13 | void PDC_napms(int ms)
14 | {
15 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
16 |
17 | if ((SP->termattrs & A_BLINK) && (GetTickCount() >= pdc_last_blink + 500))
18 | PDC_blink_text();
19 |
20 | Sleep(ms);
21 | }
22 |
23 | const char *PDC_sysname(void)
24 | {
25 | return "Windows";
26 | }
27 |
--------------------------------------------------------------------------------
/lib/os2/pdcos2.h:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 | #include
5 |
6 | #define INCL_DOS
7 | #define INCL_DOSMISC
8 | #define INCL_WIN
9 | #define INCL_VIO
10 | #define INCL_KBD
11 | #define INCL_MOU
12 | #include
13 |
14 | #include
15 |
16 | extern ULONG pdc_last_blink;
17 | extern short pdc_curstoreal[16];
18 | extern int pdc_font;
19 |
20 | extern ULONG PDC_ms_count(void);
21 | extern void PDC_get_keyboard_info(void);
22 | extern void PDC_set_keyboard_default(void);
23 | extern void PDC_blink_text(void);
24 |
--------------------------------------------------------------------------------
/lib/x11/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcx11.h"
4 |
5 | /* return width of screen/viewport */
6 |
7 | int PDC_get_columns(void)
8 | {
9 | PDC_LOG(("PDC_get_columns() - called\n"));
10 |
11 | return pdc_wwidth / pdc_fwidth;
12 | }
13 |
14 | /* get the cursor size/shape */
15 |
16 | int PDC_get_cursor_mode(void)
17 | {
18 | return 0;
19 | }
20 |
21 | /* return number of screen rows */
22 |
23 | int PDC_get_rows(void)
24 | {
25 | PDC_LOG(("PDC_get_rows() - called\n"));
26 |
27 | return pdc_wheight / pdc_fheight;
28 | }
29 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/sidebars.css:
--------------------------------------------------------------------------------
1 | .sidebar-modal-background {
2 | backdrop-filter: greyscale;
3 | background-color: none;
4 | }
5 |
6 | .sidebar {
7 | padding: 1px;
8 | filter: none;
9 | padding-left: 2px;
10 | padding-right: 2px;
11 | }
12 |
13 | .sidebar:left {
14 | border-right: 1px single #000080;
15 | }
16 |
17 | .sidebar:right {
18 | border-left: 1px single #000080;
19 | }
20 |
21 | .sidebar:top {
22 | border-bottom: 1px single #000080;
23 | }
24 |
25 | .sidebar:bottom {
26 | border-top: 1px single #000080;
27 | }
28 |
--------------------------------------------------------------------------------
/lib/pdcurses/README.md:
--------------------------------------------------------------------------------
1 | PDCurses Portable Core
2 | ======================
3 |
4 | This directory contains core PDCurses source code files common to all
5 | platforms.
6 |
7 |
8 | Building
9 | --------
10 |
11 | These modules are built by the platform-specific makefiles, in the
12 | platform directories.
13 |
14 |
15 | Distribution Status
16 | -------------------
17 |
18 | The files in this directory are released to the public domain.
19 |
20 |
21 | Acknowledgements
22 | ----------------
23 |
24 | The panel library was originally provided by
25 | Warren Tucker
26 |
--------------------------------------------------------------------------------
/lib/os2/Makefile.wcc:
--------------------------------------------------------------------------------
1 | # Watcom Makefile for PDCurses - OS/2
2 | #
3 | # Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [target]
4 | #
5 | # where target can be any of:
6 | # [all|demos|pdcurses.lib|testcurs.exe...]
7 |
8 | !ifdef %PDCURSES_SRCDIR
9 | PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
10 | !else
11 | PDCURSES_SRCDIR = ..
12 | !endif
13 |
14 | osdir = $(PDCURSES_SRCDIR)/os2
15 |
16 | CC = wcc386
17 | TARGET = os2v2
18 |
19 | CFLAGS = -bt=$(TARGET) -i=c:\watcom\h\os2
20 |
21 | !include $(PDCURSES_SRCDIR)/common/watcom.mif
22 |
23 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
24 | $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS)
25 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/frames.css:
--------------------------------------------------------------------------------
1 | .frame {
2 | border: 1px single #000080;
3 | padding-left: 1px;
4 | }
5 |
6 | .frame-contents {
7 | border-top: none;
8 | border-left: 1px single #000080;
9 | border-right: 1px single #000080;
10 | border-bottom: none;
11 | padding: 1px;
12 | padding-top: 0px;
13 | padding-left: 2px;
14 | padding-right: 2px;
15 | padding-bottom: 2px;
16 | }
17 |
18 | .frame-left-line, .frame-right-line {
19 | background-color: none;
20 | }
21 |
22 | .frame-title {
23 | background-color: none;
24 | color: #000080;
25 | }
26 |
--------------------------------------------------------------------------------
/lib/sdl1/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | /* get the cursor size/shape */
6 |
7 | int PDC_get_cursor_mode(void)
8 | {
9 | PDC_LOG(("PDC_get_cursor_mode() - called\n"));
10 |
11 | return 0;
12 | }
13 |
14 | /* return number of screen rows */
15 |
16 | int PDC_get_rows(void)
17 | {
18 | PDC_LOG(("PDC_get_rows() - called\n"));
19 |
20 | return pdc_sheight / pdc_fheight;
21 | }
22 |
23 | /* return width of screen/viewport */
24 |
25 | int PDC_get_columns(void)
26 | {
27 | PDC_LOG(("PDC_get_columns() - called\n"));
28 |
29 | return pdc_swidth / pdc_fwidth;
30 | }
31 |
--------------------------------------------------------------------------------
/lib/sdl2/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | /* get the cursor size/shape */
6 |
7 | int PDC_get_cursor_mode(void)
8 | {
9 | PDC_LOG(("PDC_get_cursor_mode() - called\n"));
10 |
11 | return 0;
12 | }
13 |
14 | /* return number of screen rows */
15 |
16 | int PDC_get_rows(void)
17 | {
18 | PDC_LOG(("PDC_get_rows() - called\n"));
19 |
20 | return pdc_sheight / pdc_fheight;
21 | }
22 |
23 | /* return width of screen/viewport */
24 |
25 | int PDC_get_columns(void)
26 | {
27 | PDC_LOG(("PDC_get_columns() - called\n"));
28 |
29 | return pdc_swidth / pdc_fwidth;
30 | }
31 |
--------------------------------------------------------------------------------
/lib/common/borland.lrf:
--------------------------------------------------------------------------------
1 | +addch.obj +addchstr.obj +addstr.obj +attr.obj +beep.obj +bkgd.obj &
2 | +border.obj +clear.obj +color.obj +delch.obj +deleteln.obj &
3 | +getch.obj +getstr.obj +getyx.obj +inch.obj +inchstr.obj +initscr.obj &
4 | +inopts.obj +insch.obj +insstr.obj +instr.obj +kernel.obj +keyname.obj &
5 | +mouse.obj +move.obj +outopts.obj +overlay.obj +pad.obj +panel.obj &
6 | +printw.obj +refresh.obj +scanw.obj +scr_dump.obj +scroll.obj +slk.obj &
7 | +termattr.obj +touch.obj +util.obj +window.obj +debug.obj &
8 | +pdcclip.obj +pdcdisp.obj +pdcgetsc.obj +pdckbd.obj +pdcscrn.obj &
9 | +pdcsetsc.obj +pdcutil.obj ,lib.map
10 |
--------------------------------------------------------------------------------
/haxe/ui/backend/PlatformImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | import haxe.ui.backend.pdcurses.lib.Keys.*;
4 |
5 | class PlatformImpl extends PlatformBase {
6 | public override function getKeyCode(keyId:String):Int {
7 | return switch (keyId) {
8 | case "tab": KEY_TAB;
9 | case "up": KEY_UP;
10 | case "down": KEY_DOWN;
11 | case "left": KEY_LEFT;
12 | case "right": KEY_RIGHT;
13 | case "space": KEY_SPACE;
14 | case "enter": KEY_ENTER;
15 | case "escape": KEY_ESCAPE;
16 | case _: keyId.charCodeAt(0);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/buttons.css:
--------------------------------------------------------------------------------
1 | .button {
2 | border: 1px thin #000088;
3 | padding: 1px 1px;
4 | color: #ffffff;
5 | background-color: #000088;
6 | filter: drop-shadow(.5, 1, #888888);
7 | spacing: 1px;
8 | }
9 |
10 | .button:hover {
11 | background-color: #0000FF;
12 | border-color: #0000FF;
13 | }
14 |
15 | .button:down {
16 | background-color: #000088;
17 | border-color: #000088;
18 | filter: drop-shadow(0, 0, #888888);
19 | }
20 |
21 | .button:active {
22 | background-color: #0000FF;
23 | border-color: #0000FF;
24 | }
25 |
26 | .button .image {
27 | color: #ffffff;
28 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/sliders.css:
--------------------------------------------------------------------------------
1 | .horizontal-slider {
2 | padding: 0;
3 | initial-width: 20px;
4 | }
5 |
6 | .horizontal-slider .slider-value {
7 | width: 100%;
8 | height: 1px;
9 | vertical-align: center;
10 | cursor: pointer;
11 | background-image: 'HLINE';
12 | background-color: none;
13 | padding: 0;
14 | }
15 |
16 | .horizontal-slider .range-value {
17 | color: #000080;
18 | background-image: 'HLINE';
19 | background-color: none;
20 | }
21 |
22 | .horizontal-slider .button {
23 | width: 1px;
24 | height: 1px;
25 | vertical-align: center;
26 | filter: none;
27 | border: none;
28 | }
29 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/progressbars.css:
--------------------------------------------------------------------------------
1 | .horizontal-progress {
2 | height: 1px;
3 | initial-width: 20px;
4 | color: #888888;
5 | border: none;
6 | padding: 0;
7 | background-image: 'CKBOARD'
8 | }
9 |
10 | .horizontal-progress .progress-value {
11 | background-color: #000088;
12 | border: none;
13 | }
14 |
15 | .vertical-progress {
16 | width: 1px;
17 | initial-height: 10px;
18 | color: #888888;
19 | border: none;
20 | padding: 0;
21 | background-image: 'CKBOARD'
22 | }
23 |
24 | .vertical-progress .progress-value {
25 | background-color: #000088;
26 | border: none;
27 | }
28 |
29 | .horizontal-progress, .progress {
30 | filter: none;
31 | }
32 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/splitters.css:
--------------------------------------------------------------------------------
1 | .vertical-splitter {
2 | spacing: 0;
3 | }
4 |
5 | .vertical-splitter-gripper {
6 | height: 1px;
7 | border: none;
8 | border-top: 1px single #C0C0C0;
9 | margin-left: 1px;
10 | margin-right: 1px;
11 | background-color: none;
12 | }
13 |
14 | .vertical-splitter-gripper:hover {
15 | background-color: none;
16 | }
17 |
18 | .horizontal-splitter {
19 | spacing: 0;
20 | }
21 |
22 | .horizontal-splitter-gripper {
23 | width: 1px;
24 | border: none;
25 | border-left: 1px single #C0C0C0;
26 | margin-top: 1px;
27 | margin-bottom: 1px;
28 | background-color: none;
29 | }
30 |
31 | .horizontal-splitter-gripper:hover {
32 | background-color: none;
33 | }
--------------------------------------------------------------------------------
/lib/x11/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcx11.h"
4 |
5 | #if defined(HAVE_POLL) && !defined(HAVE_USLEEP)
6 | # include
7 | #endif
8 |
9 | void PDC_beep(void)
10 | {
11 | PDC_LOG(("PDC_beep() - called\n"));
12 |
13 | XBell(XtDisplay(pdc_toplevel), 50);
14 | }
15 |
16 | void PDC_napms(int ms)
17 | {
18 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
19 |
20 | XSync(XtDisplay(pdc_toplevel), False);
21 |
22 | #if defined(HAVE_USLEEP)
23 |
24 | usleep(1000 * ms);
25 |
26 | #elif defined(HAVE_POLL)
27 | {
28 | struct pollfd fd;
29 | fd.fd = -1;
30 | fd.events = 0;
31 | poll(&fd, 1, ms);
32 | }
33 | #endif
34 | }
35 |
36 | const char *PDC_sysname(void)
37 | {
38 | return "X11";
39 | }
40 |
--------------------------------------------------------------------------------
/lib/os2/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcos2.h"
4 |
5 | #if defined(OS2) && !defined(__EMX__)
6 | APIRET APIENTRY DosSleep(ULONG ulTime);
7 | #endif
8 |
9 | void PDC_beep(void)
10 | {
11 | PDC_LOG(("PDC_beep() - called\n"));
12 |
13 | DosBeep(1380, 100);
14 | }
15 |
16 | ULONG PDC_ms_count(void)
17 | {
18 | ULONG now;
19 |
20 | DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &now, sizeof(ULONG));
21 |
22 | return now;
23 | }
24 |
25 | void PDC_napms(int ms)
26 | {
27 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
28 |
29 | if ((SP->termattrs & A_BLINK) && (PDC_ms_count() >= pdc_last_blink + 500))
30 | PDC_blink_text();
31 |
32 | DosSleep(ms);
33 | }
34 |
35 | const char *PDC_sysname(void)
36 | {
37 | return "OS/2";
38 | }
39 |
--------------------------------------------------------------------------------
/lib/wincon/pdcwin.h:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #if defined(PDC_WIDE) && !defined(UNICODE)
4 | # define UNICODE
5 | #endif
6 |
7 | #define WIN32_LEAN_AND_MEAN
8 | #include
9 | #undef MOUSE_MOVED
10 | #include
11 |
12 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
13 | # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */
14 | #endif
15 |
16 | typedef struct {short r, g, b; bool mapped;} PDCCOLOR;
17 |
18 | extern PDCCOLOR pdc_color[PDC_MAXCOL];
19 |
20 | extern HANDLE pdc_con_out, pdc_con_in;
21 | extern DWORD pdc_quick_edit;
22 | extern DWORD pdc_last_blink;
23 | extern short pdc_curstoreal[16], pdc_curstoansi[16];
24 | extern short pdc_oldf, pdc_oldb, pdc_oldu;
25 | extern bool pdc_conemu, pdc_ansi;
26 |
27 | extern void PDC_blink_text(void);
28 |
--------------------------------------------------------------------------------
/lib/dos/Makefile.wcc:
--------------------------------------------------------------------------------
1 | # Watcom Makefile for PDCurses - DOS
2 | #
3 | # Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [MODEL=c|h|l|m|s|f] [target]
4 | #
5 | # where target can be any of:
6 | # [all|demos|pdcurses.lib|testcurs.exe...]
7 |
8 | !ifndef MODEL
9 | MODEL = l
10 | !endif
11 |
12 | !ifdef %PDCURSES_SRCDIR
13 | PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
14 | !else
15 | PDCURSES_SRCDIR = ..
16 | !endif
17 |
18 | osdir = $(PDCURSES_SRCDIR)/dos
19 |
20 | !ifeq MODEL f
21 | CC = wcc386
22 | TARGET = dos4g
23 | !else
24 | CC = wcc
25 | TARGET = dos
26 | !endif
27 |
28 | CFLAGS = -bt=$(TARGET) -m$(MODEL)
29 |
30 | !include $(PDCURSES_SRCDIR)/common/watcom.mif
31 |
32 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
33 | %write wccdos.lrf $(LIBOBJS) $(PDCOBJS)
34 | $(LIBEXE) $@ @wccdos.lrf
35 | -$(RM) wccdos.lrf
36 |
--------------------------------------------------------------------------------
/lib/wincon/Makefile.wcc:
--------------------------------------------------------------------------------
1 | # Watcom Makefile for PDCurses - Windows console
2 | #
3 | # Usage: wmake -f [path\]Makefile.wcc [DEBUG=Y] [WIDE=Y] [UTF8=Y]
4 | # [INFOEX=N] [target]
5 | #
6 | # where target can be any of:
7 | # [all|demos|pdcurses.lib|testcurs.exe...]
8 |
9 | !ifdef %PDCURSES_SRCDIR
10 | PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
11 | !else
12 | PDCURSES_SRCDIR = ..
13 | !endif
14 |
15 | osdir = $(PDCURSES_SRCDIR)/wincon
16 |
17 | CC = wcc386
18 | TARGET = nt
19 |
20 | CFLAGS = -bt=$(TARGET)
21 |
22 | !ifeq WIDE Y
23 | CFLAGS += -DPDC_WIDE
24 | !endif
25 |
26 | !ifeq UTF8 Y
27 | CFLAGS += -DPDC_FORCE_UTF8
28 | !endif
29 |
30 | !ifeq INFOEX N
31 | CFLAGS += -DHAVE_NO_INFOEX
32 | !endif
33 |
34 | !include $(PDCURSES_SRCDIR)/common/watcom.mif
35 |
36 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
37 | $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS)
38 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/lib/Keys.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses.lib;
2 |
3 | @:include("curses.h")
4 | extern class Keys {
5 | public static inline var KEY_TAB:Int = 9;
6 | public static inline var KEY_ESCAPE:Int = 27;
7 | public static inline var KEY_SPACE:Int = 32;
8 | public static inline var KEY_ENTER:Int = 10;
9 |
10 | @:native("KEY_BTAB") public static var KEY_BTAB:Int;
11 | @:native("KEY_MOUSE") public static var KEY_MOUSE:Int;
12 | @:native("KEY_DOWN") public static var KEY_DOWN:Int;
13 | @:native("KEY_UP") public static var KEY_UP:Int;
14 | @:native("KEY_LEFT") public static var KEY_LEFT:Int;
15 | @:native("KEY_RIGHT") public static var KEY_RIGHT:Int;
16 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/ImageDisplayImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | import haxe.ui.backend.pdcurses.Window;
4 |
5 | class ImageDisplayImpl extends ImageBase {
6 | public function print(window:Window, x:Int, y:Int, fg:Int, bg:Int) {
7 | var data = _imageInfo.data;
8 |
9 | var n = 0;
10 | for (yy in 0...data.height) {
11 | for (xx in 0...data.width) {
12 | var f = fg;
13 | var b = bg;
14 |
15 | var px:Int = Std.int(x + xx + _left);
16 | var py:Int = Std.int(y + yy + _top);
17 | var c = data.data[n];
18 | if (c != -1) {
19 | f = c;
20 | b = c;
21 | }
22 | var ch = data.char;
23 | window.drawChar(px, py, f, b, ch, false);
24 | n++;
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/wincon/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcwin.h"
4 |
5 | /* get the cursor size/shape */
6 |
7 | int PDC_get_cursor_mode(void)
8 | {
9 | CONSOLE_CURSOR_INFO ci;
10 |
11 | PDC_LOG(("PDC_get_cursor_mode() - called\n"));
12 |
13 | GetConsoleCursorInfo(pdc_con_out, &ci);
14 |
15 | return ci.dwSize;
16 | }
17 |
18 | /* return number of screen rows */
19 |
20 | int PDC_get_rows(void)
21 | {
22 | CONSOLE_SCREEN_BUFFER_INFO scr;
23 |
24 | PDC_LOG(("PDC_get_rows() - called\n"));
25 |
26 | GetConsoleScreenBufferInfo(pdc_con_out, &scr);
27 |
28 | return scr.srWindow.Bottom - scr.srWindow.Top + 1;
29 | }
30 |
31 | /* return width of screen/viewport */
32 |
33 | int PDC_get_columns(void)
34 | {
35 | CONSOLE_SCREEN_BUFFER_INFO scr;
36 |
37 | PDC_LOG(("PDC_get_columns() - called\n"));
38 |
39 | GetConsoleScreenBufferInfo(pdc_con_out, &scr);
40 |
41 | return scr.srWindow.Right - scr.srWindow.Left + 1;
42 | }
43 |
--------------------------------------------------------------------------------
/lib/os2/README.md:
--------------------------------------------------------------------------------
1 | PDCurses for OS/2
2 | =================
3 |
4 | This directory contains PDCurses source code files specific to OS/2.
5 |
6 |
7 | Building
8 | --------
9 |
10 | - Choose the appropriate makefile for your compiler:
11 |
12 | Makefile - GCC/EMX
13 | Makefile.bcc - Borland C++
14 | Makefile.wcc - Watcom
15 |
16 | - Optionally, you can build in a different directory than the platform
17 | directory by setting PDCURSES_SRCDIR to point to the directory where
18 | you unpacked PDCurses, and changing to your target directory:
19 |
20 | set PDCURSES_SRCDIR=c:\pdcurses
21 |
22 | - Build it:
23 |
24 | make -f makefilename
25 |
26 | (For Watcom, use "wmake" instead of "make".) You'll get the library
27 | (pdcurses.lib or .a, depending on your compiler) and a lot of object
28 | files. Add the target "demos" to build the sample programs.
29 |
30 |
31 | Distribution Status
32 | -------------------
33 |
34 | The files in this directory are released to the public domain.
35 |
--------------------------------------------------------------------------------
/lib/x11/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.ac by autoheader. */
2 |
3 | /* Define if you have the header file */
4 | #undef HAVE_DECKEYSYM_H
5 |
6 | /* Define to 1 if you have the `poll' function. */
7 | #undef HAVE_POLL
8 |
9 | /* Define if you have the header file */
10 | #undef HAVE_SUNKEYSYM_H
11 |
12 | /* Define to 1 if you have the header file. */
13 | #undef HAVE_UNISTD_H
14 |
15 | /* Define to 1 if you have the `usleep' function. */
16 | #undef HAVE_USLEEP
17 |
18 | /* Define to 1 if you have the `vsnprintf' function. */
19 | #undef HAVE_VSNPRINTF
20 |
21 | /* Define to 1 if you have the `vsscanf' function. */
22 | #undef HAVE_VSSCANF
23 |
24 | /* Define if you have the header file */
25 | #undef HAVE_XPM_H
26 |
27 | /* Define if you want to use neXtaw library */
28 | #undef USE_NEXTAW
29 |
30 | /* Define if you want to use Xaw3d library */
31 | #undef USE_XAW3D
32 |
33 | /* Define XPointer is typedefed in X11/Xlib.h */
34 | #undef XPOINTER_TYPEDEFED
35 |
--------------------------------------------------------------------------------
/lib/demos/README.md:
--------------------------------------------------------------------------------
1 | PDCurses Demos
2 | ==============
3 |
4 | This directory contains demonstration programs to show and test the
5 | capabilities of curses libraries. Some of them predate PDCurses,
6 | PCcurses or even pcurses/ncurses. Although some PDCurses-specific code
7 | has been added, all programs remain portable to other implementations
8 | (at a minimum, to ncurses).
9 |
10 |
11 | Building
12 | --------
13 |
14 | The demos are built by the platform-specific makefiles, in the platform
15 | directories. Alternatively, you can build them manually, individually,
16 | and link with any curses library; e.g., "cc -orain rain.c -lcurses".
17 | There are no dependencies besides curses and the standard C library, and
18 | no configuration is needed.
19 |
20 |
21 | Distribution Status
22 | -------------------
23 |
24 | Public domain, except for rain.c and worm.c, which are under the ncurses
25 | license (MIT-like), and UTF-8-demo.txt, which is under Creative Commons
26 | Attribution ([CC BY]).
27 |
28 | [CC BY]: https://creativecommons.org/licenses/by/4.0/
29 |
--------------------------------------------------------------------------------
/lib/demos/nctests.mif:
--------------------------------------------------------------------------------
1 | # This provides for compiling and linking the ncurses test programs.
2 |
3 | ncurses_testdir = $(HOME)/ncurses-6.1/test
4 |
5 | NCURSES_TESTS = bs$(E) gdc$(E) hanoi$(E) knight$(E) tclock$(E) \
6 | lrtest$(E) ncurses$(E)
7 |
8 | ncurses_tests: $(NCURSES_TESTS)
9 |
10 | ncurses_clean:
11 | -rm -f *.$(O) trace $(NCURSES_TESTS)
12 |
13 | NCFLAGS = $(DEMOFLAGS) -I$(demodir) -I$(ncurses_testdir)
14 |
15 | bs$(E): $(ncurses_testdir)/bs.c
16 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS)
17 |
18 | gdc$(E): $(ncurses_testdir)/gdc.c
19 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS)
20 |
21 | hanoi$(E): $(ncurses_testdir)/hanoi.c
22 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) -lm
23 |
24 | knight$(E): $(ncurses_testdir)/knight.c
25 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS)
26 |
27 | tclock$(E): $(ncurses_testdir)/tclock.c
28 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS) -lm
29 |
30 | lrtest$(E): $(ncurses_testdir)/lrtest.c
31 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS)
32 |
33 | ncurses$(E): $(ncurses_testdir)/ncurses.c
34 | $(BUILD) $(NCFLAGS) -o $@ $< $(LDFLAGS)
35 |
--------------------------------------------------------------------------------
/lib/common/pdcurses.rc:
--------------------------------------------------------------------------------
1 | #include
2 | #include "../curses.h"
3 |
4 | VS_VERSION_INFO VERSIONINFO
5 | FILEVERSION PDC_VER_MAJOR,PDC_VER_MINOR,0,0
6 | PRODUCTVERSION PDC_VER_MAJOR,PDC_VER_MINOR,0,0
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 | #ifdef _DEBUG
9 | FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE
10 | #else
11 | FILEFLAGS 0
12 | #endif
13 | FILEOS VOS_NT_WINDOWS32
14 | FILETYPE VFT_DLL
15 | FILESUBTYPE VFT2_UNKNOWN
16 | BEGIN
17 | BLOCK "StringFileInfo"
18 | BEGIN
19 | BLOCK "04090000"
20 | BEGIN
21 | VALUE "CompanyName", "PDCurses.org"
22 | VALUE "FileDescription", "PDCurses Library"
23 | VALUE "FileVersion", PDC_VERDOT ".0.0"
24 | VALUE "InternalName", "PDCurses"
25 | VALUE "LegalCopyright", "Public Domain"
26 | VALUE "OriginalFilename", "pdcurses.dll"
27 | VALUE "ProductName", "PDCurses"
28 | VALUE "ProductVersion", PDC_VERDOT ".0.0"
29 | END
30 | END
31 | BLOCK "VarFileInfo"
32 | BEGIN
33 | VALUE "Translation", 0x409, 0
34 | END
35 | END
36 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/checkboxes.css:
--------------------------------------------------------------------------------
1 | .checkbox {
2 | spacing: 1px;
3 | color: #000080;
4 | }
5 |
6 | .checkbox:hover {
7 | color: #0000FF;
8 | }
9 |
10 | .checkbox-value {
11 | width: 3px;
12 | height: 1px;
13 | background-color: none;
14 | border: 1px square-brackets #000088;
15 | filter: none;
16 | icon: none;
17 | color: #0000FF;
18 | }
19 |
20 | .checkbox:hover .checkbox-value {
21 | border-color: #0000FF;
22 | }
23 |
24 | .checkbox-value:selected {
25 | background-image: 'X';
26 | }
27 |
28 | .optionbox {
29 | spacing: 1px;
30 | color: #000080;
31 | }
32 |
33 | .optionbox:hover {
34 | color: #0000FF;
35 | }
36 |
37 | .optionbox-value {
38 | width: 3px;
39 | height: 1px;
40 | background-color: none;
41 | border: 1px round-brackets #000088;
42 | filter: none;
43 | icon: none;
44 | color: #0000FF;
45 | }
46 |
47 | .optionbox:hover .optionbox-value {
48 | border-color: #0000FF;
49 | }
50 |
51 | .optionbox-value:selected {
52 | background-image: 'DIAMOND';
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Ian Harrigan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/common/libobjs.mif:
--------------------------------------------------------------------------------
1 | # Common elements for most of the DOS, OS/2 and Windows
2 | # makefiles (not Watcom)
3 |
4 | PDCURSES_CURSES_H = $(PDCURSES_SRCDIR)/curses.h
5 | PDCURSES_CURSPRIV_H = $(PDCURSES_SRCDIR)/curspriv.h
6 | PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H)
7 | PANEL_HEADER = $(PDCURSES_SRCDIR)/panel.h
8 |
9 | srcdir = $(PDCURSES_SRCDIR)/pdcurses
10 | demodir = $(PDCURSES_SRCDIR)/demos
11 |
12 | LIBOBJS = addch.$(O) addchstr.$(O) addstr.$(O) attr.$(O) beep.$(O) \
13 | bkgd.$(O) border.$(O) clear.$(O) color.$(O) delch.$(O) deleteln.$(O) \
14 | getch.$(O) getstr.$(O) getyx.$(O) inch.$(O) inchstr.$(O) \
15 | initscr.$(O) inopts.$(O) insch.$(O) insstr.$(O) instr.$(O) kernel.$(O) \
16 | keyname.$(O) mouse.$(O) move.$(O) outopts.$(O) overlay.$(O) pad.$(O) \
17 | panel.$(O) printw.$(O) refresh.$(O) scanw.$(O) scr_dump.$(O) scroll.$(O) \
18 | slk.$(O) termattr.$(O) touch.$(O) util.$(O) window.$(O) debug.$(O)
19 |
20 | PDCOBJS = pdcclip.$(O) pdcdisp.$(O) pdcgetsc.$(O) pdckbd.$(O) pdcscrn.$(O) \
21 | pdcsetsc.$(O) pdcutil.$(O)
22 |
23 | DEMOS = testcurs$(E) ozdemo$(E) xmas$(E) tuidemo$(E) firework$(E) \
24 | ptest$(E) rain$(E) worm$(E)
25 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/tableviews.css:
--------------------------------------------------------------------------------
1 | .tableview {
2 | background-color: none;
3 | __padding-top: 2px;
4 | __border-top: 1px solid #000088;
5 | __padding-top: 2px;
6 | border: 1px tableview #000088;
7 | }
8 |
9 | .tableview .tableview-contents {
10 | spacing: 0;
11 | width: 100%;
12 | padding: 1px;
13 | padding-top: 0;
14 | padding-bottom: 0px;
15 | }
16 |
17 | .tableview .even {
18 | background-color: none;
19 | cursor: pointer;
20 | }
21 |
22 | .tableview .odd {
23 | background-color: none;
24 | cursor: pointer;
25 | }
26 |
27 | .tableview .compounditemrenderer .itemrenderer {
28 | height: auto;
29 | padding: 0px;
30 | }
31 |
32 | .tableview .compounditemrenderer .label {
33 | color: black;
34 | }
35 |
36 | .tableview .compounditemrenderer:selected {
37 | background-color: #0000FF;
38 | color: white;
39 | }
40 |
41 | .tableview .compounditemrenderer:selected .label {
42 | color: white;
43 | }
44 |
45 | .header {
46 | spacing: 0;
47 | __margin-top: -1px;
48 | }
49 |
50 | .header .button {
51 | filter: none;
52 | __border-top: 1px solid red;
53 | }
--------------------------------------------------------------------------------
/lib/os2/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcos2.h"
4 |
5 | /* return width of screen/viewport */
6 |
7 | int PDC_get_columns(void)
8 | {
9 | VIOMODEINFO modeInfo = {0};
10 | int cols = 0;
11 |
12 | PDC_LOG(("PDC_get_columns() - called\n"));
13 |
14 | modeInfo.cb = sizeof(modeInfo);
15 | VioGetMode(&modeInfo, 0);
16 | cols = modeInfo.col;
17 |
18 | PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
19 |
20 | return cols;
21 | }
22 |
23 | /* get the cursor size/shape */
24 |
25 | int PDC_get_cursor_mode(void)
26 | {
27 | VIOCURSORINFO cursorInfo;
28 |
29 | PDC_LOG(("PDC_get_cursor_mode() - called\n"));
30 |
31 | VioGetCurType (&cursorInfo, 0);
32 |
33 | return (cursorInfo.yStart << 8) | cursorInfo.cEnd;
34 | }
35 |
36 | /* return number of screen rows */
37 |
38 | int PDC_get_rows(void)
39 | {
40 | VIOMODEINFO modeInfo = {0};
41 | int rows = 0;
42 |
43 | PDC_LOG(("PDC_get_rows() - called\n"));
44 |
45 | modeInfo.cb = sizeof(modeInfo);
46 | VioGetMode(&modeInfo, 0);
47 | rows = modeInfo.row;
48 |
49 | PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
50 |
51 | return rows;
52 | }
53 |
--------------------------------------------------------------------------------
/haxe/ui/backend/AppImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | import haxe.ui.backend.pdcurses.CursesApp;
4 | import haxe.ui.backend.pdcurses.lib.Curses;
5 |
6 | @:buildXml('')
7 | class AppImpl extends AppBase {
8 |
9 | private var _cursesApp:CursesApp;
10 |
11 | public function new() {
12 | _cursesApp = new CursesApp();
13 | }
14 |
15 | private override function init(onReady:Void->Void, onEnd:Void->Void = null) {
16 | var title:String = Toolkit.backendProperties.getProp("haxe.ui.pdcurses.title", null);
17 | if (title != null) {
18 | Curses.PDC_set_title(title);
19 | }
20 | _cursesApp.init();
21 | onReady();
22 | }
23 |
24 | private override function getToolkitInit():ToolkitOptions {
25 | return {
26 | app: _cursesApp
27 | };
28 | }
29 |
30 | public override function start() {
31 | _cursesApp.start();
32 | }
33 |
34 | public function trace(s:String) {
35 | _cursesApp.addLog(s);
36 | }
37 |
38 | public override function exit() {
39 | _cursesApp.exit = true;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/listviews.css:
--------------------------------------------------------------------------------
1 | .listview {
2 | background-color: none;
3 | }
4 |
5 | .listview .itemrenderer {
6 | height: auto;
7 | padding: 0px;
8 | background-color: none;
9 | __padding-right: 1px;
10 | }
11 |
12 | .listview .itemrenderer .label {
13 | background-color: none;
14 | }
15 |
16 | .listview .even .label {
17 | }
18 |
19 | .listview .odd .label {
20 | }
21 |
22 | .listview .itemrenderer:selected {
23 | color: #ffffff;
24 | background-color: #000088;
25 | }
26 |
27 | .listview .itemrenderer:selected .basic-renderer-label {
28 | color: #ffffff;
29 | background-color: #000088;
30 | }
31 |
32 |
33 |
34 |
35 |
36 |
37 | .listview .listview-contents {
38 | spacing: 0;
39 | padding-left: 0px;
40 | __padding-right: -1px;
41 | }
42 |
43 | .listview .itemrenderer {
44 | ____padding-right: 2px;
45 | }
46 |
47 | .listview .itemrenderer:selected {
48 | color: #ffffff;
49 | background-color: #0000ff;
50 | }
51 |
52 | .listview .itemrenderer:selected .basic-renderer-label {
53 | color: #ffffff;
54 | background-color: #0000ff;
55 | }
56 |
57 | .listview .button {
58 | filter: none;
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/lib/docs/README.md:
--------------------------------------------------------------------------------
1 | PDCurses Documentation
2 | ======================
3 |
4 | The main documentation for PDCurses is here:
5 |
6 | - [User's Guide] - Basic overview
7 | - [Implementor's Guide] - What you need to know to port PDCurses
8 | - [Manual] - Each function, etc.
9 | - [History]
10 |
11 | Also consult the README for each specific platform you'll be using:
12 |
13 | - [DOS]
14 | - [OS/2]
15 | - [SDL 1.x]
16 | - [SDL 2.x]
17 | - [Windows]
18 | - [X11]
19 |
20 | This directory also contains the files, CNAME and index.html, that
21 | create pdcurses.org, via GitHub.
22 |
23 |
24 | Building
25 | --------
26 |
27 | - To rebuild MANUAL.md from the "man page" sections of the source code,
28 | type "./mkman.sh". Needs a Unix-like shell and a Python interpreter.
29 |
30 |
31 | Distribution Status
32 | -------------------
33 |
34 | The files in this directory are released to the public domain.
35 |
36 | [User's Guide]: USERS.md
37 | [Implementor's Guide]: IMPLEMNT.md
38 | [Manual]: MANUAL.md
39 | [History]: HISTORY.md
40 | [DOS]: ../dos/README.md
41 | [OS/2]: ../os2/README.md
42 | [SDL 1.x]: ../sdl1/README.md
43 | [SDL 2.x]: ../sdl2/README.md
44 | [Windows]: ../wincon/README.md
45 | [X11]: ../x11/README.md
46 |
--------------------------------------------------------------------------------
/haxe/ui/backend/TimerImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 |
3 | class TimerImpl {
4 | static private var __timers:Array = [];
5 |
6 | static public function update() {
7 | var currentTime:Float = Sys.time();
8 | var count:Int = __timers.length;
9 | for (i in 0...count) {
10 | var timer:TimerImpl = __timers[i];
11 | if (!timer._stopped && currentTime > timer._end) {
12 | timer._end = currentTime + timer._delay;
13 | timer.callback();
14 | }
15 | }
16 |
17 | while(--count >= 0) {
18 | var timer:TimerImpl = __timers[count];
19 | if (timer._stopped) {
20 | __timers.remove(timer);
21 | }
22 | }
23 | }
24 |
25 | public var callback:Void->Void;
26 | private var _end:Float;
27 | private var _delay:Float;
28 | private var _stopped:Bool;
29 |
30 | public function new(delay:Int, callback:Void->Void) {
31 | this.callback = callback;
32 | _delay = delay / 1000;
33 | _end = Sys.time() + _delay;
34 | __timers.push(this);
35 | }
36 |
37 | public function stop() {
38 | _stopped = true;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/common/acsuni.h:
--------------------------------------------------------------------------------
1 | /* ACS Unicode mapping */
2 |
3 | chtype acs_map[128] =
4 | {
5 | PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4),
6 | PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9),
7 | PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14),
8 | PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19),
9 | PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24),
10 | PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29),
11 | PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'',
12 | '(', ')', '*',
13 |
14 | 0x2192, 0x2190, 0x2191, 0x2193,
15 |
16 | '/',
17 |
18 | 0x2588,
19 |
20 | '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
21 | '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
22 | 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
23 | 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
24 |
25 | 0x2666, 0x2592,
26 |
27 | 'b', 'c', 'd', 'e',
28 |
29 | 0x00b0, 0x00b1, 0x2591, 0x00a4, 0x2518, 0x2510, 0x250c, 0x2514,
30 | 0x253c, 0x23ba, 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524,
31 | 0x2534, 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3,
32 | 0x00b7,
33 |
34 | PDC_ACS(127)
35 | };
36 |
--------------------------------------------------------------------------------
/haxe/ui/backend/AssetsImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 | import haxe.Resource;
3 | import haxe.ui.assets.ImageInfo;
4 | import haxe.ui.backend.pdcurses.Image;
5 | import haxe.ui.backend.pdcurses.ppm.PPMImage;
6 |
7 | class AssetsImpl extends AssetsBase {
8 | private override function getImageInternal(resourceId:String, callback:ImageInfo->Void) {
9 | if (Resource.getString(resourceId) != null) {
10 | var ppm = PPMImage.fromString(Resource.getString(resourceId));
11 | callback({
12 | data: ppm,
13 | width: ppm.width,
14 | height: ppm.height
15 | });
16 | return;
17 | }
18 |
19 | var ppm = PPMImage.fromChar(resourceId);
20 | if (ppm == null) {
21 | callback(null);
22 | } else {
23 | callback({
24 | data: ppm,
25 | width: ppm.width,
26 | height: ppm.height
27 | });
28 | }
29 | /*
30 | var char = Image.charFromString(resourceId);
31 | if (char == -1) {
32 | callback(null);
33 | } else {
34 | callback({
35 | data: resourceId,
36 | width: 1,
37 | height: 1
38 | });
39 | }
40 | */
41 | }
42 | }
--------------------------------------------------------------------------------
/lib/common/acsgr.h:
--------------------------------------------------------------------------------
1 | /* ACS Unicode mapping with punchouts for box characters et al. */
2 |
3 | chtype acs_map[128] =
4 | {
5 | PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4),
6 | PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9),
7 | PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14),
8 | PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19),
9 | PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24),
10 | PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29),
11 | PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'',
12 | '(', ')', '*',
13 |
14 | 0x2192, 0x2190, 0x2191, 0x2193,
15 |
16 | '/',
17 |
18 | ACS_BLOCK,
19 |
20 | '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
21 | '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
22 | 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
23 | 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
24 |
25 | 0x2666, 0x2592,
26 |
27 | 'b', 'c', 'd', 'e',
28 |
29 | 0x00b0, 0x00b1, 0x2591, 0x00a4, ACS_LRCORNER, ACS_URCORNER,
30 | ACS_ULCORNER, ACS_LLCORNER, ACS_PLUS, ACS_S1, ACS_S3, ACS_HLINE,
31 | ACS_S7, ACS_S9, ACS_LTEE, ACS_RTEE, ACS_BTEE, ACS_TTEE, ACS_VLINE,
32 | 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7,
33 |
34 | PDC_ACS(127)
35 | };
36 |
--------------------------------------------------------------------------------
/lib/common/acs437.h:
--------------------------------------------------------------------------------
1 | /* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
2 | match code page 437 and compatible pages (CP850, CP852, etc.) */
3 |
4 | chtype acs_map[128] =
5 | {
6 | PDC_ACS(0), PDC_ACS(1), PDC_ACS(2), PDC_ACS(3), PDC_ACS(4),
7 | PDC_ACS(5), PDC_ACS(6), PDC_ACS(7), PDC_ACS(8), PDC_ACS(9),
8 | PDC_ACS(10), PDC_ACS(11), PDC_ACS(12), PDC_ACS(13), PDC_ACS(14),
9 | PDC_ACS(15), PDC_ACS(16), PDC_ACS(17), PDC_ACS(18), PDC_ACS(19),
10 | PDC_ACS(20), PDC_ACS(21), PDC_ACS(22), PDC_ACS(23), PDC_ACS(24),
11 | PDC_ACS(25), PDC_ACS(26), PDC_ACS(27), PDC_ACS(28), PDC_ACS(29),
12 | PDC_ACS(30), PDC_ACS(31), ' ', '!', '"', '#', '$', '%', '&', '\'',
13 | '(', ')', '*',
14 |
15 | PDC_ACS(0x1a), PDC_ACS(0x1b), PDC_ACS(0x18), PDC_ACS(0x19),
16 |
17 | '/',
18 |
19 | 0xdb,
20 |
21 | '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
22 | '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
23 | 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
24 | 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
25 |
26 | PDC_ACS(0x04), 0xb1,
27 |
28 | 'b', 'c', 'd', 'e',
29 |
30 | 0xf8, 0xf1, 0xb0, PDC_ACS(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d,
31 | 0x2d, 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3, 0xf2,
32 | 0xe3, 0xd8, 0x9c, 0xf9,
33 |
34 | PDC_ACS(127)
35 | };
36 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/Mouse.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses;
2 |
3 | class Mouse {
4 | public static inline var MOVE:String = "onmove";
5 | public static inline var PRESSED:String = "onpressed";
6 | public static inline var RELEASED:String = "onreleased";
7 | public static inline var WHEEL_UP:String = "onwheelup";
8 | public static inline var WHEEL_DOWN:String = "onwheeldown";
9 |
10 | private static var _listeners:MapInt->Void>> = new MapInt->Void>>();
11 |
12 | public static function listen(on:String, callback:Int->Int->Void) {
13 | var list = _listeners.get(on);
14 | if (list == null) {
15 | list = [];
16 | _listeners.set(on, list);
17 | }
18 | list.push(callback);
19 | }
20 |
21 | public static function unlisten(on:String, callback:Int->Int->Void) {
22 | var list = _listeners.get(on);
23 | if (list != null) {
24 | list.remove(callback);
25 | if (list.length == 0) {
26 | _listeners.remove(on);
27 | }
28 | }
29 | }
30 |
31 | public static function update(on:String, x:Int, y:Int) {
32 | var list = _listeners.get(on);
33 | if (list != null) {
34 | for (l in list) {
35 | l(x, y);
36 | }
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/lib/common/iconbmp.h:
--------------------------------------------------------------------------------
1 | /* The PDCurses logo as #include'able BMP (from icon32.xpm),
2 | for use by SDL. */
3 |
4 | unsigned char iconbmp[] =
5 | {
6 | 0x42, 0x4d, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
7 | 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
8 | 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
9 | 0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b,
10 | 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
11 | 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
12 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0x6f, 0x9c,
13 | 0xe7, 0xb5, 0xaf, 0x6b, 0x5b, 0xbd, 0xaf, 0xeb, 0xfb, 0xbd, 0xaf,
14 | 0x98, 0xe7, 0xbd, 0xaf, 0x7b, 0x5f, 0xb5, 0xa5, 0x6b, 0x5b, 0xcd,
15 | 0xab, 0x9c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
16 | 0xff, 0xcf, 0x03, 0xff, 0xff, 0xce, 0x03, 0xff, 0xff, 0xcc, 0x73,
17 | 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc, 0xf3, 0xff, 0xff, 0xcc,
18 | 0x73, 0xff, 0xff, 0xc6, 0x33, 0xff, 0xff, 0xc3, 0x13, 0xff, 0xff,
19 | 0xc1, 0x83, 0xff, 0xff, 0xc8, 0xc3, 0xff, 0xff, 0xcc, 0x63, 0xff,
20 | 0xff, 0xce, 0x33, 0xff, 0xff, 0xcf, 0x33, 0xff, 0xff, 0xcf, 0x33,
21 | 0xff, 0xff, 0xce, 0x33, 0xff, 0xff, 0xc0, 0x73, 0xff, 0xff, 0xc0,
22 | 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
23 | 0xff, 0xff, 0xff
24 | };
25 |
--------------------------------------------------------------------------------
/lib/sdl1/pdcsdl.h:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 | #ifdef PDC_WIDE
5 | #include
6 | #endif
7 |
8 | #include
9 |
10 | #ifdef PDC_WIDE
11 | PDCEX TTF_Font *pdc_ttffont;
12 | PDCEX int pdc_font_size;
13 | #endif
14 | PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
15 | PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
16 |
17 | extern SDL_Surface *pdc_tileback; /* used to regenerate the background
18 | of "transparent" cells */
19 | extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */
20 | extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as
21 | used in _highlight() */
22 | extern int pdc_fheight, pdc_fwidth; /* font height and width */
23 | extern int pdc_fthick; /* thickness for highlights and
24 | rendered ACS glyphs */
25 | extern int pdc_flastc; /* font palette's last color
26 | (treated as the foreground) */
27 | extern bool pdc_own_screen; /* if pdc_screen was not set
28 | before initscr(), PDCurses is
29 | responsible for (owns) it */
30 |
31 | PDCEX void PDC_update_rects(void);
32 | PDCEX void PDC_retile(void);
33 |
34 | extern void PDC_blink_text(void);
35 |
--------------------------------------------------------------------------------
/lib/dos/README.md:
--------------------------------------------------------------------------------
1 | PDCurses for DOS
2 | ================
3 |
4 | This directory contains PDCurses source code files specific to DOS.
5 |
6 |
7 | Building
8 | --------
9 |
10 | - Choose the appropriate makefile for your compiler:
11 |
12 | Makefile - DJGPP
13 | Makefile.bcc - Borland C++
14 | Makefile.wcc - Watcom
15 |
16 | - For 16-bit compilers, you can change the memory MODEL as a command-
17 | line option. (Large model is the default, and recommended.) With
18 | Watcom, specifying "MODEL=f" (flat) will automatically switch to a
19 | 32-bit build.
20 |
21 | - Optionally, you can build in a different directory than the platform
22 | directory by setting PDCURSES_SRCDIR to point to the directory where
23 | you unpacked PDCurses, and changing to your target directory:
24 |
25 | set PDCURSES_SRCDIR=c:\pdcurses
26 |
27 | - Build it:
28 |
29 | make -f makefile
30 |
31 | (For Watcom, use "wmake" instead of "make".) You'll get the library
32 | (pdcurses.lib or .a, depending on your compiler) and a lot of object
33 | files. Add the target "demos" to build the sample programs.
34 |
35 |
36 | Distribution Status
37 | -------------------
38 |
39 | The files in this directory are released to the public domain.
40 |
41 |
42 | Acknowledgements
43 | ----------------
44 |
45 | Watcom C port was provided by Pieter Kunst
46 |
47 | DJGPP port was provided by David Nugent
48 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/tabs.css:
--------------------------------------------------------------------------------
1 | .tabbar {
2 | background-color: none;
3 | border-bottom: 1px thin-inverse #FFFFFF;
4 | }
5 |
6 | .tabbar:bottom {
7 | background-color: none;
8 | border-bottom: none;
9 | border-top: 1px thin-inverse #FFFFFF;
10 | }
11 |
12 | .tabbar > .tabbar-contents {
13 | spacing: 0;
14 | }
15 |
16 | .tabbar-button {
17 | background-color: #000088;
18 | border:1px thin #000088;
19 | filter: none;
20 | }
21 |
22 | .tabbar-button:hover {
23 | background-color: #0000FF;
24 | border: 1px thin #0000FF;
25 | filter: none;
26 | }
27 |
28 | .tabbar-button-selected {
29 | color: #000088;
30 | background-color: #FFFFFF;
31 | border-color: #FFFFFF;
32 | border-bottom: 1px thin #FFFFFF;
33 | }
34 |
35 |
36 | .tabview {
37 | padding-bottom: 1px;
38 | }
39 |
40 | .tabview > .tabview-tabs {
41 | margin-top: 0px;
42 | }
43 |
44 | .tabview > .tabview-content {
45 | margin-top: 0px;
46 | border: none;
47 | border-bottom: 1px thin #FFFFFF;
48 | filter: drop-shadow(.5, 1, #888888);
49 | padding-top: 0px;
50 | padding-left: 1px;
51 | padding-bottom: 1px;
52 | padding-right: 1px;
53 | }
54 |
55 | .tabview:bottom > .tabview-tabs {
56 | margin-top: 0px;
57 | }
58 |
59 | .tabview:bottom > .tabview-content {
60 | margin-top: 0px;
61 | border: none;
62 | border-top: 1px thin #FFFFFF;
63 | filter: drop-shadow(.5, 1, #888888);
64 | }
65 |
--------------------------------------------------------------------------------
/lib/common/icon32.xpm:
--------------------------------------------------------------------------------
1 | /* XPM */
2 | static char *icon32[] = {
3 | /* width height ncolors chars_per_pixel */
4 | "32 32 3 1",
5 | /* colors */
6 | " c #000",
7 | ". c #FFF",
8 | "X c None",
9 | /* pixels */
10 | "................................",
11 | "................................",
12 | "................................",
13 | ".......... .... ..........",
14 | ".......... ... ..........",
15 | ".......... ... .. ..........",
16 | ".......... .... .. ..........",
17 | ".......... .... .. ..........",
18 | ".......... ... .. ..........",
19 | ".......... .. .. ..........",
20 | ".......... . .. ..........",
21 | ".......... .. ..........",
22 | ".......... .. . ..........",
23 | ".......... .. .. ..........",
24 | ".......... .. ... ..........",
25 | ".......... .. .... ..........",
26 | ".......... .. .... ..........",
27 | ".......... .. ... ..........",
28 | ".......... ... ..........",
29 | ".......... .... ..........",
30 | "................................",
31 | "................................",
32 | ".. .. .. . . ... ... ... ...",
33 | ". .. . .. . . . .. . .. . .. ..",
34 | ". .... .. . .... .... .. . .....",
35 | ". .... .. . ..... .. ... ...",
36 | ". .... .. . ....... . ....... ..",
37 | ". .. . .. . .... .. . .. . .. ..",
38 | ".. ... .. ..... ... ... ...",
39 | "................................",
40 | "................................",
41 | "................................"
42 | };
43 |
--------------------------------------------------------------------------------
/lib/sdl2/pdcsdl.h:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 | #ifdef PDC_WIDE
5 | # include
6 | #endif
7 |
8 | #include
9 |
10 | #ifdef PDC_WIDE
11 | PDCEX TTF_Font *pdc_ttffont;
12 | PDCEX int pdc_font_size;
13 | #endif
14 | PDCEX SDL_Window *pdc_window;
15 | PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
16 | PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
17 |
18 | extern SDL_Surface *pdc_tileback; /* used to regenerate the background
19 | of "transparent" cells */
20 | extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */
21 | extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as
22 | used in _highlight() */
23 | extern int pdc_fheight, pdc_fwidth; /* font height and width */
24 | extern int pdc_fthick; /* thickness for highlights and
25 | rendered ACS glyphs */
26 | extern int pdc_flastc; /* font palette's last color
27 | (treated as the foreground) */
28 | extern bool pdc_own_window; /* if pdc_window was not set
29 | before initscr(), PDCurses is
30 | responsible for (owns) it */
31 |
32 | PDCEX void PDC_update_rects(void);
33 | PDCEX void PDC_retile(void);
34 |
35 | extern void PDC_pump_and_peep(void);
36 | extern void PDC_blink_text(void);
37 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/scrollviews.css:
--------------------------------------------------------------------------------
1 | .scrollview {
2 | border: 1px single #000088;
3 | background-color: none;
4 | padding-right: 1px;
5 | }
6 |
7 | .scrollview-contents {
8 | padding-left: 1px;
9 | padding-top: 0;
10 | padding-bottom: 0;
11 | padding-right: 0px;
12 | }
13 |
14 | .scrollview .horizontal-scroll {
15 | margin-top: 1px;
16 | margin-right: 1px;
17 | }
18 |
19 | .scrollview .vertical-scroll {
20 | margin-left: 2px;
21 | }
22 |
23 | .scrollview:active {
24 | border-color: #0000FF;
25 | }
26 |
27 | .scrollview:active .scroll {
28 | __background-color: #0000FF;
29 | color: #0000FF;
30 | __border-color: #0000FF;
31 | }
32 |
33 | .scrollview:active .scroll .thumb {
34 | background-color: #0000FF;
35 | __color: #0000FF;
36 | ___border-color: #0000FF;
37 | }
38 |
39 | /*
40 |
41 | .horizontal-scroll {
42 | height: 1px;
43 | border: none;
44 | padding: 0;
45 |
46 |
47 | filter: none;
48 | background-image: 'CKBOARD';
49 | background-color: #FFFFFF;
50 | color: #000080;
51 | }
52 |
53 | .horizontal-scroll .thumb {
54 | background-color: red;
55 | filter: none;
56 | }
57 |
58 | .vertical-scroll .thumb {
59 | background-color: red;
60 | filter: none;
61 | }
62 |
63 | .vertical-scroll {
64 | width: 1px;
65 | border: none;
66 | padding: 0;
67 |
68 |
69 | filter: none;
70 | background-image: 'CKBOARD';
71 | background-color: #FFFFFF;
72 | color: #000080;
73 | }
74 | */
--------------------------------------------------------------------------------
/lib/os2/Makefile.bcc:
--------------------------------------------------------------------------------
1 | # Borland Makefile for PDCurses - OS/2
2 | #
3 | # Usage: make -f [path\]Makefile.bcc [DEBUG=] [target]
4 | #
5 | # where target can be any of:
6 | # [all|demos|pdcurses.lib|testcurs.exe...]
7 |
8 | O = obj
9 | E = .exe
10 | RM = del
11 |
12 | !ifndef PDCURSES_SRCDIR
13 | PDCURSES_SRCDIR = ..
14 | !endif
15 |
16 | !include $(PDCURSES_SRCDIR)\common\libobjs.mif
17 |
18 | osdir = $(PDCURSES_SRCDIR)\os2
19 |
20 | CC = bcc
21 |
22 | !ifdef DEBUG
23 | CFLAGS = -N -v -y -DPDCDEBUG
24 | !else
25 | CFLAGS = -O
26 | !endif
27 |
28 | CPPFLAGS = -I$(PDCURSES_SRCDIR)
29 |
30 | BUILD = $(CC) -w-par -c $(CFLAGS) $(CPPFLAGS)
31 |
32 | LINK = tlink
33 |
34 | LIBEXE = tlib /C /E
35 |
36 | LIBCURSES = pdcurses.lib
37 |
38 | all: $(LIBCURSES)
39 |
40 | clean:
41 | -$(RM) *.obj
42 | -$(RM) *.lib
43 | -$(RM) *.map
44 | -$(RM) *.exe
45 |
46 | demos: $(LIBCURSES) $(DEMOS)
47 |
48 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
49 | -$(RM) $@
50 | $(LIBEXE) $@ @$(PDCURSES_SRCDIR)\common\borland.lrf
51 |
52 | .autodepend
53 |
54 | {$(srcdir)\}.c.obj:
55 | $(BUILD) $<
56 |
57 | {$(osdir)\}.c.obj:
58 | $(BUILD) $<
59 |
60 | {$(demodir)\}.c.obj:
61 | $(BUILD) $<
62 |
63 | .c.obj:
64 | $(BUILD) $<
65 |
66 | .obj.exe:
67 | $(CC) -e$@ $** $(LIBCURSES)
68 |
69 | tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
70 | $(CC) -e$@ $**
71 |
72 | tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
73 | $(BUILD) -I$(demodir) $(demodir)\tui.c
74 |
75 | tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
76 | $(BUILD) -I$(demodir) $(demodir)\tuidemo.c
77 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Expected Behavior
4 |
5 |
6 |
7 | ## Current Behavior
8 |
9 |
10 |
11 | ## Possible Solution
12 |
13 |
14 |
15 | ## Steps to Reproduce (for bugs)
16 |
17 |
18 | 1.
19 | 2.
20 | 3.
21 | 4.
22 |
23 | ## Media
24 |
25 |
26 | ## Test app / minimal test case
27 |
28 |
29 |
30 | ## Context
31 |
32 |
33 |
34 | ## Your Environment
35 |
36 | * Version used:
37 | * Environment name and version (e.g. Chrome 39, node.js 5.4):
38 | * Operating System and version (desktop or mobile):
39 | * Link to your project:
40 |
--------------------------------------------------------------------------------
/lib/dos/Makefile.bcc:
--------------------------------------------------------------------------------
1 | # Borland Makefile for PDCurses - DOS
2 | #
3 | # Usage: make -f [path\]Makefile.bcc [DEBUG=] [MODEL=c|h|l|m|s] [target]
4 | #
5 | # where target can be any of:
6 | # [all|demos|pdcurses.lib|testcurs.exe...]
7 |
8 | !ifndef MODEL
9 | MODEL = l
10 | !endif
11 |
12 | O = obj
13 | E = .exe
14 | RM = del
15 |
16 | !ifndef PDCURSES_SRCDIR
17 | PDCURSES_SRCDIR = ..
18 | !endif
19 |
20 | !include $(PDCURSES_SRCDIR)\common\libobjs.mif
21 |
22 | osdir = $(PDCURSES_SRCDIR)\dos
23 |
24 | !ifdef DEBUG
25 | CFLAGS = -N -v -y -DPDCDEBUG
26 | !else
27 | CFLAGS = -O
28 | !endif
29 |
30 | CPPFLAGS = -I$(PDCURSES_SRCDIR)
31 |
32 | BUILD = $(CC) -1- -G -d -w-par -c -m$(MODEL) $(CFLAGS) $(CPPFLAGS)
33 |
34 | LIBEXE = tlib /C /E
35 |
36 | LIBCURSES = pdcurses.lib
37 |
38 | all: $(LIBCURSES)
39 |
40 | clean:
41 | -$(RM) *.obj
42 | -$(RM) *.lib
43 | -$(RM) *.map
44 | -$(RM) *.exe
45 |
46 | demos: $(LIBCURSES) $(DEMOS)
47 |
48 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
49 | -$(RM) $@
50 | $(LIBEXE) $@ @$(PDCURSES_SRCDIR)\common\borland.lrf
51 |
52 | .autodepend
53 |
54 | {$(srcdir)\}.c.obj:
55 | $(BUILD) $<
56 |
57 | {$(osdir)\}.c.obj:
58 | $(BUILD) $<
59 |
60 | {$(demodir)\}.c.obj:
61 | $(BUILD) $<
62 |
63 | .c.obj:
64 | $(BUILD) $<
65 |
66 | .obj.exe:
67 | $(CC) -m$(MODEL) -e$@ $** $(LIBCURSES)
68 |
69 | tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
70 | $(CC) -m$(MODEL) -e$@ $**
71 |
72 | tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
73 | $(BUILD) -I$(demodir) $(demodir)\tui.c
74 |
75 | tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
76 | $(BUILD) -I$(demodir) $(demodir)\tuidemo.c
77 |
--------------------------------------------------------------------------------
/lib/panel.h:
--------------------------------------------------------------------------------
1 | /*----------------------------------------------------------------------*
2 | * Panels for PDCurses *
3 | *----------------------------------------------------------------------*/
4 |
5 | #ifndef __PDCURSES_PANEL_H__
6 | #define __PDCURSES_PANEL_H__ 1
7 |
8 | #include
9 |
10 | #ifdef __cplusplus
11 | extern "C"
12 | {
13 | #endif
14 |
15 | typedef struct panelobs
16 | {
17 | struct panelobs *above;
18 | struct panel *pan;
19 | } PANELOBS;
20 |
21 | typedef struct panel
22 | {
23 | WINDOW *win;
24 | int wstarty;
25 | int wendy;
26 | int wstartx;
27 | int wendx;
28 | struct panel *below;
29 | struct panel *above;
30 | const void *user;
31 | struct panelobs *obscure;
32 | } PANEL;
33 |
34 | PDCEX int bottom_panel(PANEL *pan);
35 | PDCEX int del_panel(PANEL *pan);
36 | PDCEX int hide_panel(PANEL *pan);
37 | PDCEX int move_panel(PANEL *pan, int starty, int startx);
38 | PDCEX PANEL *new_panel(WINDOW *win);
39 | PDCEX PANEL *panel_above(const PANEL *pan);
40 | PDCEX PANEL *panel_below(const PANEL *pan);
41 | PDCEX int panel_hidden(const PANEL *pan);
42 | PDCEX const void *panel_userptr(const PANEL *pan);
43 | PDCEX WINDOW *panel_window(const PANEL *pan);
44 | PDCEX int replace_panel(PANEL *pan, WINDOW *win);
45 | PDCEX int set_panel_userptr(PANEL *pan, const void *uptr);
46 | PDCEX int show_panel(PANEL *pan);
47 | PDCEX int top_panel(PANEL *pan);
48 | PDCEX void update_panels(void);
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 |
54 | #endif /* __PDCURSES_PANEL_H__ */
55 |
--------------------------------------------------------------------------------
/lib/dos/pdcgetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcdos.h"
4 |
5 | #include
6 |
7 | /* return width of screen/viewport */
8 |
9 | int PDC_get_columns(void)
10 | {
11 | PDCREGS regs;
12 | int cols;
13 |
14 | PDC_LOG(("PDC_get_columns() - called\n"));
15 |
16 | regs.h.ah = 0x0f;
17 | PDCINT(0x10, regs);
18 | cols = (int)regs.h.ah;
19 |
20 | PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
21 |
22 | return cols;
23 | }
24 |
25 | /* get the cursor size/shape */
26 |
27 | int PDC_get_cursor_mode(void)
28 | {
29 | PDC_LOG(("PDC_get_cursor_mode() - called\n"));
30 |
31 | return getdosmemword(0x460);
32 | }
33 |
34 | /* return number of screen rows */
35 |
36 | int PDC_get_rows(void)
37 | {
38 | int rows;
39 |
40 | PDC_LOG(("PDC_get_rows() - called\n"));
41 |
42 | rows = getdosmembyte(0x484) + 1;
43 |
44 | if (rows == 1 && pdc_adapter == _MDS_GENIUS)
45 | rows = 66;
46 | if (rows == 1 && pdc_adapter == _MDA)
47 | rows = 25;
48 |
49 | if (rows == 1)
50 | {
51 | rows = 25;
52 | pdc_direct_video = FALSE;
53 | }
54 |
55 | switch (pdc_adapter)
56 | {
57 | case _EGACOLOR:
58 | case _EGAMONO:
59 | switch (rows)
60 | {
61 | case 25:
62 | case 43:
63 | break;
64 | default:
65 | rows = 25;
66 | }
67 | break;
68 |
69 | case _VGACOLOR:
70 | case _VGAMONO:
71 | break;
72 |
73 | default:
74 | rows = 25;
75 | break;
76 | }
77 |
78 | PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
79 |
80 | return rows;
81 | }
82 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/Keyboard.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses;
2 |
3 | import haxe.ui.backend.pdcurses.lib.Curses.*;
4 | import haxe.ui.backend.pdcurses.lib.Keys.*;
5 |
6 | class Keyboard {
7 | public static inline var PRESSED:String = "onpressed";
8 |
9 | private static var _listeners:MapBool->Void>> = new MapBool->Void>>();
10 |
11 | public static function listen(on:String, callback:Int->Bool->Void) {
12 | var list = _listeners.get(on);
13 | if (list == null) {
14 | list = [];
15 | _listeners.set(on, list);
16 | }
17 | list.push(callback);
18 | }
19 |
20 | public static function unlisten(on:String, callback:Int->Bool->Void) {
21 | var list = _listeners.get(on);
22 | if (list != null) {
23 | list.remove(callback);
24 | if (list.length == 0) {
25 | _listeners.remove(on);
26 | }
27 | }
28 | }
29 |
30 | public static function update(key:Int) {
31 | if (key != -1 && key != KEY_MOUSE) {
32 | var m = PDC_get_key_modifiers();
33 | var shift = false;
34 | if (m != PDC_BUTTON_SHIFT) {
35 | shift = true;
36 | }
37 | if (shift == true) {
38 | if (key == KEY_BTAB) {
39 | key = KEY_TAB;
40 | }
41 | }
42 | var list = _listeners.get(PRESSED);
43 | if (list != null) {
44 | for (l in list) {
45 | l(key, shift);
46 | }
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/lib/pdcurses/beep.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | beep
8 | ----
9 |
10 | ### Synopsis
11 |
12 | int beep(void);
13 | int flash(void);
14 |
15 | ### Description
16 |
17 | beep() sounds the audible bell on the terminal, if possible; if not,
18 | it calls flash().
19 |
20 | flash() "flashes" the screen, by inverting the foreground and
21 | background of every cell, pausing, and then restoring the original
22 | attributes.
23 |
24 | ### Return Value
25 |
26 | These functions return ERR if called before initscr(), otherwise OK.
27 |
28 | ### Portability
29 | X/Open ncurses NetBSD
30 | beep Y Y Y
31 | flash Y Y Y
32 |
33 | **man-end****************************************************************/
34 |
35 | int beep(void)
36 | {
37 | PDC_LOG(("beep() - called\n"));
38 |
39 | if (!SP)
40 | return ERR;
41 |
42 | if (SP->audible)
43 | PDC_beep();
44 | else
45 | flash();
46 |
47 | return OK;
48 | }
49 |
50 | int flash(void)
51 | {
52 | int z, y, x;
53 |
54 | PDC_LOG(("flash() - called\n"));
55 |
56 | if (!curscr)
57 | return ERR;
58 |
59 | /* Reverse each cell; wait; restore the screen */
60 |
61 | for (z = 0; z < 2; z++)
62 | {
63 | for (y = 0; y < LINES; y++)
64 | for (x = 0; x < COLS; x++)
65 | curscr->_y[y][x] ^= A_REVERSE;
66 |
67 | wrefresh(curscr);
68 |
69 | if (!z)
70 | napms(50);
71 | }
72 |
73 | return OK;
74 | }
75 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/dropdowns.css:
--------------------------------------------------------------------------------
1 | .dropdown {
2 | __border: 1px outset;
3 | icon: 'DARROW';
4 | __filter: none;
5 | }
6 |
7 | .dropdown:down {
8 | __border: 1px outset;
9 | icon: 'UARROW'
10 | }
11 |
12 | .dropdown .image {
13 | background-color: none;
14 | color: white;
15 | border: none;
16 | }
17 |
18 | .dropdown-popup {
19 | __border: 1px dropdownpopup;
20 | __padding: 1px;
21 | __background-color: none;
22 | }
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | .dropdown {
43 | __border: 1px thin #000080;
44 | spacing: 2px;
45 | }
46 |
47 | .dropdown:down {
48 | background-color: #0000FF;
49 | border-color: #0000FF;
50 | }
51 |
52 | .dropdown-popup {
53 | background-color: #C0C0C0;
54 | filter: none;
55 | border: none;
56 | __padding: 1px;
57 | padding-left: 1px;
58 | padding-top: 1px;
59 | padding-right: 1px;
60 | padding-bottom: 1px;
61 | border-top: 1px thin #000080;
62 | border-bottom: 1px thin #000080;
63 | filter: drop-shadow(.5, 1, #888888);
64 |
65 | background-color: #000080;
66 | }
67 |
68 | .dropdown-popup .listview {
69 | padding: 0;
70 | border: none;
71 | __background-color: #C0C0C0;
72 | }
73 |
74 | .dropdown-popup .listview .listview-contents {
75 | __padding: 1px;
76 | }
77 |
78 | .dropdown-popup .listview .label {
79 | color: white;
80 | }
81 |
82 | .dropdown-popup .listview .vertical-scroll {
83 | margin-left: 0;
84 | color: white;
85 | }
86 |
87 | .dropdown-popup .listview .vertical-scroll .thumb {
88 | color: white;
89 | background-color: white;
90 | }
91 |
--------------------------------------------------------------------------------
/lib/demos/ncurses_cfg.h:
--------------------------------------------------------------------------------
1 | /* This file is only used with the ncurses test programs.
2 | *
3 | * Have ncurses-6.1 unpacked in your $(HOME) (you don't need to build
4 | * it), or edit ncurses_testdir appropriately in the Makefile or
5 | * nctests.mif. Configure and build PDCurses, and:
6 | *
7 | * "make ncurses_tests" to start.
8 | * "make ncurses_clean" when you're done.
9 | *
10 | * Builds: bs gdc hanoi knight tclock ncurses
11 | */
12 |
13 | #define PDC_NCMOUSE
14 | #define DATA_DIR "."
15 | #define NCURSES_CONST
16 | #define NCURSES_EXPORT(foo) foo
17 | #define popup_msg(bar, baz)
18 |
19 | #define RETSIGTYPE void
20 | #define TIME_WITH_SYS_TIME 1
21 | #define HAVE_SYS_TIME_H 1
22 | #define HAVE_SYS_TIME_SELECT 1
23 | #define HAVE_UNISTD_H 1
24 | #define HAVE_TERMATTRS 1
25 |
26 | #include
27 |
28 | #define ExitProgram exit
29 |
30 | #define HAVE_ASSUME_DEFAULT_COLORS 1
31 | #define HAVE_CURSES_VERSION 1
32 | #define HAVE_GETBEGX 1
33 | #define HAVE_GETCURX 1
34 | #define HAVE_GETMAXX 1
35 | #define HAVE_GETNSTR 1
36 | #define HAVE_GETTIMEOFDAY 1
37 | #define HAVE_GETWIN 1
38 | #define HAVE_HALFDELAY 1
39 | #define HAVE_LIBPANEL 1
40 | #define HAVE_LOCALE_H 1
41 | #define HAVE_MATH_H 1
42 | #define HAVE_NAPMS 1
43 | #define HAVE_NEWPAD 1
44 | #define HAVE_PANEL_H 1
45 | #define HAVE_PUTWIN 1
46 | #define HAVE_SLK_COLOR 1
47 | #define HAVE_SLK_INIT 1
48 | #define HAVE_USE_DEFAULT_COLORS 1
49 | #define HAVE_WRESIZE 1
50 |
51 | #ifdef PDC_WIDE
52 | # define USE_WIDEC_SUPPORT 1
53 | # define HAVE_WCSRTOMBS 1
54 | # define HAVE_MBSRTOWCS 1
55 | # define HAVE_MBRTOWC 1
56 | # define HAVE_MBRLEN 1
57 | #endif
58 |
59 | /* Fool ncurses.c so it gives us all the tests, and doesn't redefine
60 | ACS_ chars
61 | */
62 |
63 | #define NCURSES_VERSION PDCURSES
64 |
--------------------------------------------------------------------------------
/lib/README.md:
--------------------------------------------------------------------------------
1 | Welcome to PDCurses!
2 | ====================
3 |
4 | PDCurses is an implementation of X/Open curses for multiple platforms.
5 | The latest version can be found at:
6 |
7 | https://pdcurses.org/
8 |
9 | For changes, see the [History] file. The main documentation is now in
10 | the [docs] directory.
11 |
12 |
13 | Legal Stuff
14 | -----------
15 |
16 | The core package is in the public domain, but small portions of PDCurses
17 | are subject to copyright under various licenses. Each directory
18 | contains a README.md file, with a section titled "Distribution Status"
19 | which describes the status of the files in that directory.
20 |
21 | If you use PDCurses in an application, an acknowledgement would be
22 | appreciated, but is not mandatory. If you make corrections or
23 | enhancements to PDCurses, please forward them to the current maintainer
24 | for the benefit of other users.
25 |
26 | This software is provided AS IS with NO WARRANTY whatsoever.
27 |
28 |
29 | Ports
30 | -----
31 |
32 | PDCurses has been ported to DOS, OS/2, Windows, X11 and SDL. A directory
33 | containing the port-specific source files exists for each of these
34 | platforms.
35 |
36 | Build instructions are in the README.md file for each platform:
37 |
38 | - [DOS]
39 | - [OS/2]
40 | - [SDL 1.x]
41 | - [SDL 2.x]
42 | - [Windows]
43 | - [X11]
44 |
45 |
46 | Distribution Status
47 | -------------------
48 |
49 | All files in this directory (not including subdirectories) are released
50 | to the public domain.
51 |
52 |
53 | Maintainer
54 | ----------
55 |
56 | William McBrine
57 |
58 | [History]: docs/HISTORY.md
59 | [docs]: docs/README.md
60 | [DOS]: dos/README.md
61 | [OS/2]: os2/README.md
62 | [SDL 1.x]: sdl1/README.md
63 | [SDL 2.x]: sdl2/README.md
64 | [Windows]: wincon/README.md
65 | [X11]: x11/README.md
66 |
--------------------------------------------------------------------------------
/lib/demos/tui.h:
--------------------------------------------------------------------------------
1 | /*
2 | * 'textual user interface'
3 | *
4 | * Author : P.J. Kunst
5 | * Date : 1993-02-25
6 | */
7 |
8 | #ifndef _TUI_H_
9 | #define _TUI_H_
10 |
11 | #include
12 |
13 | #ifdef A_COLOR
14 | #define A_ATTR (A_ATTRIBUTES ^ A_COLOR) /* A_BLINK, A_REVERSE, A_BOLD */
15 | #else
16 | #define A_ATTR (A_ATTRIBUTES) /* standard UNIX attributes */
17 | #endif
18 |
19 | #define MAXSTRLEN 256
20 | #define KEY_ESC 0x1b /* Escape */
21 |
22 | typedef void (*FUNC)(void);
23 |
24 | typedef struct
25 | {
26 | char *name; /* item label */
27 | FUNC func; /* (pointer to) function */
28 | char *desc; /* function description */
29 | } menu;
30 |
31 | /* ANSI C function prototypes: */
32 |
33 | void clsbody(void);
34 | int bodylen(void);
35 | WINDOW *bodywin(void);
36 |
37 | void rmerror(void);
38 | void rmstatus(void);
39 |
40 | void titlemsg(char *msg);
41 | void bodymsg(char *msg);
42 | void errormsg(char *msg);
43 | void statusmsg(char *msg);
44 |
45 | bool keypressed(void);
46 | int getkey(void);
47 | int waitforkey(void);
48 |
49 | void DoExit(void);
50 | void startmenu(menu *mp, char *title);
51 | void domenu(menu *mp);
52 |
53 | int weditstr(WINDOW *win, char *buf, int field);
54 | WINDOW *winputbox(WINDOW *win, int nlines, int ncols);
55 | int getstrings(char *desc[], char *buf[], int field);
56 |
57 | #define editstr(s,f) (weditstr(stdscr,s,f))
58 | #define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f))
59 | #define mvweditstr(w,y,x,s,f) (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f))
60 |
61 | #define inputbox(l,c) (winputbox(stdscr,l,c))
62 | #define mvinputbox(y,x,l,c) (move(y,x)==ERR?w:inputbox(l,c))
63 | #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c))
64 |
65 | #endif
66 |
--------------------------------------------------------------------------------
/lib/dos/Makefile:
--------------------------------------------------------------------------------
1 | # GNU Makefile for PDCurses - DOS
2 | #
3 | # Usage: make [-f path\Makefile] [DEBUG=Y] [target]
4 | #
5 | # where target can be any of:
6 | # [all|libs|demos|pdcurses.a|testcurs.exe...]
7 |
8 | O = o
9 | E = .exe
10 | RM = del
11 |
12 | ifndef PDCURSES_SRCDIR
13 | PDCURSES_SRCDIR = ..
14 | endif
15 |
16 | include $(PDCURSES_SRCDIR)/common/libobjs.mif
17 |
18 | osdir = $(PDCURSES_SRCDIR)/dos
19 |
20 | PDCURSES_DOS_H = $(osdir)/pdcdos.h
21 |
22 | CC = gcc
23 |
24 | ifeq ($(DEBUG),Y)
25 | CFLAGS = -g -Wall -DPDCDEBUG
26 | LDFLAGS = -g
27 | else
28 | CFLAGS = -O2 -Wall
29 | LDFLAGS =
30 | endif
31 |
32 | CFLAGS += -I$(PDCURSES_SRCDIR)
33 |
34 | LINK = gcc
35 |
36 | LIBEXE = ar
37 | LIBFLAGS = rcv
38 |
39 | LIBCURSES = pdcurses.a
40 |
41 | .PHONY: all libs clean demos dist
42 |
43 | all: libs
44 |
45 | libs: $(LIBCURSES)
46 |
47 | clean:
48 | -$(RM) *.o
49 | -$(RM) *.a
50 | -$(RM) *.exe
51 |
52 | demos: $(DEMOS)
53 | ifneq ($(DEBUG),Y)
54 | strip *.exe
55 | endif
56 |
57 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
58 | $(LIBEXE) $(LIBFLAGS) $@ $?
59 |
60 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
61 | $(PDCOBJS) : $(PDCURSES_DOS_H)
62 | $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
63 | panel.o : $(PANEL_HEADER)
64 |
65 | $(LIBOBJS) : %.o: $(srcdir)/%.c
66 | $(CC) -c $(CFLAGS) $<
67 |
68 | $(PDCOBJS) : %.o: $(osdir)/%.c
69 | $(CC) -c $(CFLAGS) $<
70 |
71 | firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
72 | ptest.exe: %.exe: $(demodir)/%.c
73 | $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES)
74 |
75 | tuidemo.exe: tuidemo.o tui.o
76 | $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES)
77 |
78 | tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H)
79 | $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
80 |
81 | tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H)
82 | $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
83 |
--------------------------------------------------------------------------------
/lib/wincon/Makefile.bcc:
--------------------------------------------------------------------------------
1 | # Borland Makefile for PDCurses - Windows console
2 | #
3 | # Usage: make -f [path\]Makefile.bcc [DEBUG=Y] [WIDE=Y] [UTF8=Y]
4 | # [INFOEX=N] [target]
5 | #
6 | # where target can be any of:
7 | # [all|demos|pdcurses.lib|testcurs.exe...]
8 |
9 | O = obj
10 | E = .exe
11 | RM = del
12 |
13 | !ifndef PDCURSES_SRCDIR
14 | PDCURSES_SRCDIR = ..
15 | !endif
16 |
17 | !include $(PDCURSES_SRCDIR)\common\libobjs.mif
18 |
19 | osdir = $(PDCURSES_SRCDIR)\wincon
20 |
21 | CC = bcc32c -q
22 |
23 | !ifdef DEBUG
24 | CFLAGS = -N -v -y -DPDCDEBUG
25 | !else
26 | CFLAGS = -O
27 | !endif
28 |
29 | !ifdef WIDE
30 | WIDEOPT = -DPDC_WIDE
31 | !endif
32 |
33 | !ifdef UTF8
34 | UTF8OPT = -DPDC_FORCE_UTF8
35 | !endif
36 |
37 | !ifdef INFOEX
38 | INFOPT = -DHAVE_NO_INFOEX
39 | !endif
40 |
41 | BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \
42 | $(WIDEOPT) $(UTF8OPT) $(INFOPT)
43 | BUILD_OS = $(BUILD) -Xdriver -Wno-deprecated-declarations
44 |
45 | LIBEXE = tlib /C /E /0 /a
46 |
47 | LIBCURSES = pdcurses.lib
48 |
49 | all: $(LIBCURSES)
50 |
51 | clean:
52 | -$(RM) *.obj
53 | -$(RM) *.lib
54 | -$(RM) *.tds
55 | -$(RM) *.exe
56 |
57 | demos: $(LIBCURSES) $(DEMOS)
58 |
59 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
60 | -$(RM) $@
61 | $(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS)
62 |
63 | .autodepend
64 |
65 | {$(srcdir)\}.c.obj:
66 | $(BUILD) $<
67 |
68 | {$(osdir)\}.c.obj:
69 | $(BUILD_OS) $<
70 |
71 | {$(demodir)\}.c.obj:
72 | $(BUILD) $<
73 |
74 | .c.obj:
75 | $(BUILD_OS) $<
76 |
77 | .obj.exe:
78 | $(CC) -e$@ $** $(LIBCURSES)
79 |
80 | tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
81 | $(CC) -e$@ $**
82 |
83 | tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
84 | $(BUILD) -I$(demodir) $(demodir)\tui.c
85 |
86 | tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
87 | $(BUILD) -I$(demodir) $(demodir)\tuidemo.c
88 |
--------------------------------------------------------------------------------
/lib/sdl1/sdltest.c:
--------------------------------------------------------------------------------
1 | /* Here's a simple example of combining SDL and PDCurses functionality.
2 | The top portion of the window is devoted to SDL, with a four-line
3 | (assuming the default 8x16 font) stdscr at the bottom.
4 | */
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | /* You could #include pdcsdl.h, or just add the relevant declarations
12 | here: */
13 |
14 | PDCEX SDL_Surface *pdc_screen;
15 | PDCEX int pdc_yoffset;
16 |
17 | int main(int argc, char **argv)
18 | {
19 | char inp[60];
20 | int i, j, seed;
21 |
22 | seed = time((time_t *)0);
23 | srand(seed);
24 |
25 | /* Initialize SDL */
26 |
27 | if (SDL_Init(SDL_INIT_VIDEO) < 0)
28 | exit(1);
29 |
30 | atexit(SDL_Quit);
31 |
32 | pdc_screen = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE|SDL_ANYFORMAT);
33 |
34 | /* Initialize PDCurses */
35 |
36 | pdc_yoffset = 416; /* 480 - 4 * 16 */
37 |
38 | initscr();
39 | start_color();
40 | scrollok(stdscr, TRUE);
41 |
42 | PDC_set_title("PDCurses for SDL");
43 |
44 | /* Do some SDL stuff */
45 |
46 | for (i = 640, j = 416; j; i -= 2, j -= 2)
47 | {
48 | SDL_Rect dest;
49 |
50 | dest.x = (640 - i) / 2;
51 | dest.y = (416 - j) / 2;
52 | dest.w = i;
53 | dest.h = j;
54 |
55 | SDL_FillRect(pdc_screen, &dest,
56 | SDL_MapRGB(pdc_screen->format, rand() % 256,
57 | rand() % 256, rand() % 256));
58 | }
59 |
60 | SDL_UpdateRect(pdc_screen, 0, 0, 640, 416);
61 |
62 | /* Do some curses stuff */
63 |
64 | init_pair(1, COLOR_WHITE + 8, COLOR_BLUE);
65 | bkgd(COLOR_PAIR(1));
66 |
67 | addstr("This is a demo of ");
68 | attron(A_UNDERLINE);
69 | addstr("PDCurses for SDL");
70 | attroff(A_UNDERLINE);
71 | addstr(".\nYour comments here: ");
72 | getnstr(inp, 59);
73 | addstr("Press any key to exit.");
74 |
75 | getch();
76 | endwin();
77 |
78 | return 0;
79 | }
80 |
--------------------------------------------------------------------------------
/lib/common/watcom.mif:
--------------------------------------------------------------------------------
1 | # Common elements for the Watcom makefiles
2 |
3 | CFLAGS += -wx -zq -i=$(PDCURSES_SRCDIR)
4 |
5 | !ifeq DEBUG Y
6 | CFLAGS += -d2 -DPDCDEBUG
7 | LDFLAGS = D W A op q sys $(TARGET)
8 | !else
9 | CFLAGS += -oneatx
10 | LDFLAGS = op q sys $(TARGET)
11 | !endif
12 |
13 | RM = del
14 | LIBEXE = wlib -q -n -b -c -t
15 |
16 | srcdir = $(PDCURSES_SRCDIR)/pdcurses
17 | demodir = $(PDCURSES_SRCDIR)/demos
18 |
19 | LIBOBJS = addch.obj addchstr.obj addstr.obj attr.obj beep.obj bkgd.obj &
20 | border.obj clear.obj color.obj delch.obj deleteln.obj &
21 | getch.obj getstr.obj getyx.obj inch.obj inchstr.obj initscr.obj inopts.obj &
22 | insch.obj insstr.obj instr.obj kernel.obj keyname.obj mouse.obj move.obj &
23 | outopts.obj overlay.obj pad.obj panel.obj printw.obj refresh.obj &
24 | scanw.obj scr_dump.obj scroll.obj slk.obj termattr.obj &
25 | touch.obj util.obj window.obj debug.obj
26 |
27 | PDCOBJS = pdcclip.obj pdcdisp.obj pdcgetsc.obj pdckbd.obj pdcscrn.obj &
28 | pdcsetsc.obj pdcutil.obj
29 |
30 | DEMOS = testcurs.exe ozdemo.exe xmas.exe tuidemo.exe firework.exe &
31 | ptest.exe rain.exe worm.exe
32 |
33 | LIBCURSES = pdcurses.lib
34 |
35 | LINK = wlink
36 |
37 | !ifdef __LOADDLL__
38 | ! loaddll wcc wccd
39 | ! loaddll wcc386 wccd386
40 | ! loaddll wlink wlinkd
41 | ! loaddll wlib wlibd
42 | !endif
43 |
44 | all: $(LIBCURSES)
45 |
46 | clean
47 | -$(RM) *.obj
48 | -$(RM) *.lib
49 | -$(RM) *.exe
50 | -$(RM) *.err
51 |
52 | demos: $(DEMOS)
53 |
54 | .c: $(srcdir);$(osdir);$(demodir)
55 | .c.obj: .autodepend
56 | $(CC) $(CFLAGS) $<
57 |
58 | .obj.exe:
59 | $(LINK) $(LDFLAGS) n $@ f $*.obj l $(LIBCURSES)
60 |
61 | testcurs.exe: testcurs.obj $(LIBCURSES)
62 | ozdemo.exe: ozdemo.obj $(LIBCURSES)
63 | xmas.exe: xmas.obj $(LIBCURSES)
64 | firework.exe: firework.obj $(LIBCURSES)
65 | rain.exe: rain.obj $(LIBCURSES)
66 | worm.exe: worm.obj $(LIBCURSES)
67 | ptest.exe: ptest.obj $(LIBCURSES)
68 |
69 | tuidemo.exe: tuidemo.obj tui.obj $(LIBCURSES)
70 | $(LINK) $(LDFLAGS) n $@ f tuidemo.obj f tui.obj l $(LIBCURSES)
71 |
72 | dist: .symbolic
73 |
--------------------------------------------------------------------------------
/lib/x11/scrlbox.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 1989 O'Reilly and Associates, Inc.
3 |
4 | The X Consortium, and any party obtaining a copy of these files from
5 | the X Consortium, directly or indirectly, is granted, free of charge, a
6 | full and unrestricted irrevocable, world-wide, paid up, royalty-free,
7 | nonexclusive right and license to deal in this software and
8 | documentation files (the "Software"), including without limitation the
9 | rights to use, copy, modify, merge, publish, distribute, sublicense,
10 | and/or sell copies of the Software, and to permit persons who receive
11 | copies from any such party to do so. This license includes without
12 | limitation a license to do the foregoing actions under any patents of
13 | the party supplying this software to the X Consortium.
14 | */
15 |
16 | #ifndef _XORAscrollBox_h
17 | #define _XORAscrollBox_h
18 |
19 | /* scrollBox Widget (subclass of CompositeClass) */
20 |
21 | /* Parameters:
22 |
23 | Name Class RepType Default Value
24 | ---- ----- ------- -------------
25 | background Background Pixel XtDefaultBackground
26 | border BorderColor Pixel XtDefaultForeground
27 | borderWidth BorderWidth Dimension 1
28 | destroyCallback Callback Pointer NULL
29 | hSpace HSpace Dimension 4
30 | height Height Dimension 0
31 | mappedWhenManaged MappedWhenManaged Boolean True
32 | vSpace VSpace Dimension 4
33 | width Width Dimension 0
34 | x Position Position 0
35 | y Position Position 0
36 |
37 | */
38 |
39 |
40 | /* Class record constants */
41 |
42 | extern WidgetClass scrollBoxWidgetClass;
43 |
44 | typedef struct _ScrollBoxClassRec *ScrollBoxWidgetClass;
45 | typedef struct _ScrollBoxRec *ScrollBoxWidget;
46 |
47 | #endif /* _XORAscrollBox_h */
48 |
--------------------------------------------------------------------------------
/haxe/ui/backend/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/lib/x11/xcurses-config.in:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | #
3 | # The idea to this kind of setup info script was stolen from numerous
4 | # other packages, such as neon, libxml and gnome.
5 | #
6 |
7 | verdot=@PACKAGE_VERSION@
8 |
9 | prefix=@prefix@
10 | exec_prefix=@exec_prefix@
11 | libdir=@libdir@
12 | includedir=@includedir@/xcurses
13 |
14 | usage()
15 | {
16 | echo "Usage: xcurses-config [OPTION]"
17 | echo ""
18 | echo "Available values for OPTION include:"
19 | echo ""
20 | echo " --help display this help and exit"
21 | echo " --cflags pre-processor and compiler flags"
22 | echo " [-I$includedir @PDC_WIDE@]"
23 | echo " --libs library linking information"
24 | echo " [-L$libdir -lXCurses @LDFLAGS@ @MH_EXTRA_LIBS@"
25 | echo " --libs-static static library linking information (libXCurses only)"
26 | echo " [$libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@"
27 | echo " --prefix PDCurses install prefix"
28 | echo " [$prefix]"
29 | echo " --version output version information"
30 | echo " [$verdot]"
31 | exit $1
32 | }
33 |
34 | if test $# -eq 0; then
35 | usage 1
36 | fi
37 |
38 | while test $# -gt 0; do
39 | case "$1" in
40 | # this deals with options in the style
41 | # --option=value and extracts the value part
42 | # [not currently used]
43 | -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
44 | *) value= ;;
45 | esac
46 |
47 | case "$1" in
48 | --prefix)
49 | echo $prefix
50 | ;;
51 |
52 | --version)
53 | echo $verdot
54 | exit 0
55 | ;;
56 |
57 | --help)
58 | usage 0
59 | ;;
60 |
61 | --cflags)
62 | echo -I$includedir @PDC_WIDE@
63 | ;;
64 |
65 | --libs)
66 | echo -L$libdir -lXCurses @LDFLAGS@ @MH_EXTRA_LIBS@
67 | ;;
68 |
69 | --libs-static)
70 | echo $libdir/libXCurses.a @LDFLAGS@ @MH_XLIBS@ @MH_EXTRA_LIBS@
71 | ;;
72 |
73 | *)
74 | usage
75 | exit 1
76 | ;;
77 | esac
78 | shift
79 | done
80 |
81 | exit 0
82 |
--------------------------------------------------------------------------------
/lib/x11/pdcx11.h:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #ifdef HAVE_CONFIG_H
4 | # include "config.h"
5 | #endif
6 |
7 | #include
8 |
9 | #ifdef HAVE_UNISTD_H
10 | # include
11 | #endif
12 |
13 | #include
14 |
15 | #include
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #define XCURSESDISPLAY (XtDisplay(pdc_drawing))
24 | #define XCURSESWIN (XtWindow(pdc_drawing))
25 |
26 | typedef struct
27 | {
28 | int lines;
29 | int cols;
30 | Pixel colorBlack;
31 | Pixel colorRed;
32 | Pixel colorGreen;
33 | Pixel colorYellow;
34 | Pixel colorBlue;
35 | Pixel colorMagenta;
36 | Pixel colorCyan;
37 | Pixel colorWhite;
38 | Pixel colorBoldBlack;
39 | Pixel colorBoldRed;
40 | Pixel colorBoldGreen;
41 | Pixel colorBoldYellow;
42 | Pixel colorBoldBlue;
43 | Pixel colorBoldMagenta;
44 | Pixel colorBoldCyan;
45 | Pixel colorBoldWhite;
46 | Pixel pointerForeColor;
47 | Pixel pointerBackColor;
48 | XFontStruct *normalFont;
49 | XFontStruct *italicFont;
50 | XFontStruct *boldFont;
51 | char *bitmap;
52 | char *pixmap;
53 | Cursor pointer;
54 | int clickPeriod;
55 | int doubleClickPeriod;
56 | int scrollbarWidth;
57 | int cursorBlinkRate;
58 | char *textCursor;
59 | int textBlinkRate;
60 | } XCursesAppData;
61 |
62 | extern Pixel pdc_color[PDC_MAXCOL];
63 | extern XIC pdc_xic;
64 |
65 | extern XCursesAppData pdc_app_data;
66 | extern XtAppContext pdc_app_context;
67 | extern Widget pdc_toplevel, pdc_drawing;
68 |
69 | extern GC pdc_normal_gc, pdc_cursor_gc, pdc_italic_gc, pdc_bold_gc;
70 | extern int pdc_fheight, pdc_fwidth, pdc_fascent, pdc_fdescent;
71 | extern int pdc_wwidth, pdc_wheight;
72 |
73 | extern bool pdc_blinked_off, pdc_window_entered, pdc_resize_now;
74 | extern bool pdc_vertical_cursor, pdc_visible_cursor;
75 |
76 | int PDC_display_cursor(int, int, int, int, int);
77 |
78 | void PDC_blink_cursor(XtPointer, XtIntervalId *);
79 | void PDC_blink_text(XtPointer, XtIntervalId *);
80 | int PDC_kb_setup(void);
81 | void PDC_redraw_cursor(void);
82 | bool PDC_scrollbar_init(const char *);
83 |
--------------------------------------------------------------------------------
/lib/pdcurses/move.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | move
8 | ----
9 |
10 | ### Synopsis
11 |
12 | int move(int y, int x);
13 | int mvcur(int oldrow, int oldcol, int newrow, int newcol);
14 | int wmove(WINDOW *win, int y, int x);
15 |
16 | ### Description
17 |
18 | move() and wmove() move the cursor associated with the window to the
19 | given location. This does not move the physical cursor of the
20 | terminal until refresh() is called. The position specified is
21 | relative to the upper left corner of the window, which is (0,0).
22 |
23 | mvcur() moves the physical cursor without updating any window cursor
24 | positions.
25 |
26 | ### Return Value
27 |
28 | All functions return OK on success and ERR on error.
29 |
30 | ### Portability
31 | X/Open ncurses NetBSD
32 | move Y Y Y
33 | mvcur Y Y Y
34 | wmove Y Y Y
35 |
36 | **man-end****************************************************************/
37 |
38 | int move(int y, int x)
39 | {
40 | PDC_LOG(("move() - called: y=%d x=%d\n", y, x));
41 |
42 | if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy)
43 | return ERR;
44 |
45 | stdscr->_curx = x;
46 | stdscr->_cury = y;
47 |
48 | return OK;
49 | }
50 |
51 | int mvcur(int oldrow, int oldcol, int newrow, int newcol)
52 | {
53 | PDC_LOG(("mvcur() - called: oldrow %d oldcol %d newrow %d newcol %d\n",
54 | oldrow, oldcol, newrow, newcol));
55 |
56 | if (!SP || newrow < 0 || newrow >= LINES || newcol < 0 || newcol >= COLS)
57 | return ERR;
58 |
59 | PDC_gotoyx(newrow, newcol);
60 | SP->cursrow = newrow;
61 | SP->curscol = newcol;
62 |
63 | return OK;
64 | }
65 |
66 | int wmove(WINDOW *win, int y, int x)
67 | {
68 | PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x));
69 |
70 | if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy)
71 | return ERR;
72 |
73 | win->_curx = x;
74 | win->_cury = y;
75 |
76 | return OK;
77 | }
78 |
--------------------------------------------------------------------------------
/lib/sdl2/sdltest.c:
--------------------------------------------------------------------------------
1 | /* Here's a simple example of combining SDL and PDCurses functionality.
2 | The top portion of the window is devoted to SDL, with a four-line
3 | (assuming the default 8x16 font) stdscr at the bottom.
4 | */
5 |
6 | #define SDL_MAIN_HANDLED
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | /* You could #include pdcsdl.h, or just add the relevant declarations
14 | here: */
15 |
16 | PDCEX SDL_Window *pdc_window;
17 | PDCEX SDL_Surface *pdc_screen;
18 | PDCEX int pdc_yoffset;
19 |
20 | int main(int argc, char **argv)
21 | {
22 | char inp[60];
23 | int i, j, seed;
24 |
25 | seed = time((time_t *)0);
26 | srand(seed);
27 |
28 | /* Initialize SDL */
29 |
30 | if (SDL_Init(SDL_INIT_VIDEO) < 0)
31 | exit(1);
32 |
33 | atexit(SDL_Quit);
34 |
35 | pdc_window = SDL_CreateWindow("PDCurses for SDL", SDL_WINDOWPOS_UNDEFINED,
36 | SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
37 | pdc_screen = SDL_GetWindowSurface(pdc_window);
38 |
39 | /* Initialize PDCurses */
40 |
41 | pdc_yoffset = 416; /* 480 - 4 * 16 */
42 |
43 | initscr();
44 | start_color();
45 | scrollok(stdscr, TRUE);
46 |
47 | PDC_set_title("PDCurses for SDL");
48 |
49 | /* Do some SDL stuff */
50 |
51 | for (i = 640, j = 416; j; i -= 2, j -= 2)
52 | {
53 | SDL_Rect dest;
54 |
55 | dest.x = (640 - i) / 2;
56 | dest.y = (416 - j) / 2;
57 | dest.w = i;
58 | dest.h = j;
59 |
60 | SDL_FillRect(pdc_screen, &dest,
61 | SDL_MapRGB(pdc_screen->format, rand() % 256,
62 | rand() % 256, rand() % 256));
63 | }
64 |
65 | SDL_UpdateWindowSurface(pdc_window);
66 |
67 | /* Do some curses stuff */
68 |
69 | init_pair(1, COLOR_WHITE + 8, COLOR_BLUE);
70 | bkgd(COLOR_PAIR(1));
71 |
72 | addstr("This is a demo of ");
73 | attron(A_UNDERLINE);
74 | addstr("PDCurses for SDL");
75 | attroff(A_UNDERLINE);
76 | addstr(".\nYour comments here: ");
77 | getnstr(inp, 59);
78 | addstr("Press any key to exit.");
79 |
80 | getch();
81 | endwin();
82 |
83 | return 0;
84 | }
85 |
--------------------------------------------------------------------------------
/lib/os2/Makefile:
--------------------------------------------------------------------------------
1 | # GNU Makefile for PDCurses - OS/2
2 | #
3 | # Usage: make [-f path\Makefile] [DEBUG=Y] [target]
4 | #
5 | # where target can be any of:
6 | # [all|demos|pdcurses.a|testcurs.exe...]
7 |
8 | O = o
9 | E = .exe
10 | RM = del
11 |
12 | ifndef PDCURSES_SRCDIR
13 | PDCURSES_SRCDIR = ..
14 | endif
15 |
16 | include $(PDCURSES_SRCDIR)/common/libobjs.mif
17 |
18 | osdir = $(PDCURSES_SRCDIR)/os2
19 |
20 | PDCURSES_OS2_H = $(osdir)/pdcos2.h
21 |
22 | CC = gcc
23 |
24 | CFLAGS = -c -I$(PDCURSES_SRCDIR) -Ic:/emx/include -Wall
25 |
26 | ifeq ($(DEBUG),Y)
27 | CFLAGS += -g -DPDCDEBUG
28 | LDFLAGS = -g
29 | else
30 | CFLAGS += -O2
31 | LDFLAGS =
32 | endif
33 |
34 | LINK = gcc
35 | EMXBIND = emxbind
36 | EMXOMF = emxomf
37 |
38 | LIBEXE = ar
39 | LIBFLAGS = rcv
40 |
41 | LIBCURSES = pdcurses.a
42 | LIBDEPS = $(LIBOBJS) $(PDCOBJS)
43 | PDCLIBS = $(LIBCURSES)
44 | EXEPOST = $(EMXBIND) $*
45 | TUIPOST = $(EMXBIND) tuidemo
46 | CLEAN = *.a testcurs ozdemo xmas tuidemo firework ptest rain worm
47 |
48 | .PHONY: all libs clean demos dist
49 |
50 | all: libs
51 |
52 | libs: $(PDCLIBS)
53 |
54 | clean:
55 | -$(RM) *.o
56 | -$(RM) *.exe
57 | -$(RM) $(CLEAN)
58 |
59 | demos: $(DEMOS)
60 |
61 | DEMOOBJS = testcurs.o ozdemo.o xmas.o tui.o tuidemo.o firework.o \
62 | ptest.o rain.o worm.o
63 |
64 | $(LIBCURSES) : $(LIBDEPS)
65 | $(LIBEXE) $(LIBFLAGS) $@ $?
66 |
67 | $(LIBOBJS) $(PDCOBJS) $(DEMOOBJS) : $(PDCURSES_HEADERS)
68 | $(PDCOBJS) : $(PDCURSES_OS2_H)
69 | $(DEMOS) : $(LIBCURSES)
70 | panel.o ptest.o: $(PANEL_HEADER)
71 |
72 | $(LIBOBJS) : %.o: $(srcdir)/%.c
73 | $(CC) $(CFLAGS) -o$@ $<
74 |
75 | $(PDCOBJS) : %.o: $(osdir)/%.c
76 | $(CC) $(CFLAGS) -o$@ $<
77 |
78 | firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
79 | ptest.exe: %.exe: %.o
80 | $(LINK) $(LDFLAGS) -o $* $< $(LIBCURSES)
81 | $(EXEPOST)
82 |
83 | tuidemo.exe: tuidemo.o tui.o
84 | $(LINK) $(LDFLAGS) -o tuidemo tuidemo.o tui.o $(LIBCURSES)
85 | $(TUIPOST)
86 |
87 | firework.o ozdemo.o ptest.o rain.o testcurs.o worm.o xmas.o: %.o: \
88 | $(demodir)/%.c
89 | $(CC) $(CFLAGS) -o$@ $<
90 |
91 | tui.o: $(demodir)\tui.c $(demodir)\tui.h
92 | $(CC) $(CFLAGS) -I$(demodir) -o $@ $<
93 |
94 | tuidemo.o: $(demodir)\tuidemo.c
95 | $(CC) $(CFLAGS) -I$(demodir) -o $@ $<
96 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/BorderTypes.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses;
2 |
3 | typedef BorderCharSet = {
4 | var t:Int;
5 | var l:Int;
6 | var b:Int;
7 | var r:Int;
8 | var tl:Int;
9 | var tr:Int;
10 | var bl:Int;
11 | var br:Int;
12 | @:optional var useBackgroundColor:Bool;
13 | }
14 |
15 | class BorderTypes {
16 | public static var borderTypes:Map = new Map();
17 |
18 | private static var _populated:Bool = false;
19 | public static function populate() {
20 | _populated = true;
21 | borderTypes.set("single", {
22 | t: Std.int(Chars.HLINE),
23 | l: Std.int(Chars.VLINE),
24 | b: Std.int(Chars.HLINE),
25 | r: Std.int(Chars.VLINE),
26 | tl: Std.int(Chars.ULCORNER),
27 | tr: Std.int(Chars.URCORNER),
28 | bl: Std.int(Chars.LLCORNER),
29 | br: Std.int(Chars.LRCORNER),
30 | useBackgroundColor: true
31 | });
32 |
33 | borderTypes.set("solid", {
34 | t: Std.int(Chars.BLOCK),
35 | l: Std.int(Chars.BLOCK),
36 | b: Std.int(Chars.BLOCK),
37 | r: Std.int(Chars.BLOCK),
38 | tl: Std.int(Chars.BLOCK),
39 | tr: Std.int(Chars.BLOCK),
40 | bl: Std.int(Chars.BLOCK),
41 | br: Std.int(Chars.BLOCK)
42 | });
43 |
44 | borderTypes.set("thin", {
45 | t: 220,
46 | l: Std.int(Chars.BLOCK),
47 | b: 223,
48 | r: Std.int(Chars.BLOCK),
49 | tl: 220,
50 | tr: 220,
51 | bl: 223,
52 | br: 223
53 | });
54 |
55 | borderTypes.set("thin-inverse", {
56 | t: 223,
57 | l: Std.int(Chars.BLOCK),
58 | b: 220,
59 | r: Std.int(Chars.BLOCK),
60 | tl: 223,
61 | tr: 223,
62 | bl: 220,
63 | br: 220,
64 | useBackgroundColor: true
65 | });
66 | }
67 |
68 | public static function get(type:String):BorderCharSet {
69 | if (_populated == false) {
70 | populate();
71 | }
72 | return borderTypes.get(type);
73 | }
74 | }
--------------------------------------------------------------------------------
/lib/dos/pdcutil.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcdos.h"
4 |
5 | void PDC_beep(void)
6 | {
7 | PDCREGS regs;
8 |
9 | PDC_LOG(("PDC_beep() - called\n"));
10 |
11 | regs.W.ax = 0x0e07; /* Write ^G in TTY fashion */
12 | regs.W.bx = 0;
13 | PDCINT(0x10, regs);
14 | }
15 |
16 | void PDC_napms(int ms)
17 | {
18 | PDCREGS regs;
19 | long goal, start, current;
20 |
21 | PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
22 |
23 | goal = DIVROUND((long)ms, 50);
24 | if (!goal)
25 | goal++;
26 |
27 | start = getdosmemdword(0x46c);
28 |
29 | goal += start;
30 |
31 | while (goal > (current = getdosmemdword(0x46c)))
32 | {
33 | if (current < start) /* in case of midnight reset */
34 | return;
35 |
36 | regs.W.ax = 0x1680;
37 | PDCINT(0x2f, regs);
38 | PDCINT(0x28, regs);
39 | }
40 | }
41 |
42 | const char *PDC_sysname(void)
43 | {
44 | return "DOS";
45 | }
46 |
47 | #ifdef __DJGPP__
48 |
49 | unsigned char getdosmembyte(int offset)
50 | {
51 | unsigned char b;
52 |
53 | dosmemget(offset, sizeof(unsigned char), &b);
54 | return b;
55 | }
56 |
57 | unsigned short getdosmemword(int offset)
58 | {
59 | unsigned short w;
60 |
61 | dosmemget(offset, sizeof(unsigned short), &w);
62 | return w;
63 | }
64 |
65 | unsigned long getdosmemdword(int offset)
66 | {
67 | unsigned long dw;
68 |
69 | dosmemget(offset, sizeof(unsigned long), &dw);
70 | return dw;
71 | }
72 |
73 | void setdosmembyte(int offset, unsigned char b)
74 | {
75 | dosmemput(&b, sizeof(unsigned char), offset);
76 | }
77 |
78 | void setdosmemword(int offset, unsigned short w)
79 | {
80 | dosmemput(&w, sizeof(unsigned short), offset);
81 | }
82 |
83 | #endif
84 |
85 | #if defined(__WATCOMC__) && defined(__386__)
86 |
87 | void PDC_dpmi_int(int vector, pdc_dpmi_regs *rmregs)
88 | {
89 | union REGPACK regs = {0};
90 |
91 | rmregs->w.ss = 0;
92 | rmregs->w.sp = 0;
93 | rmregs->w.flags = 0;
94 |
95 | regs.w.ax = 0x300;
96 | regs.h.bl = vector;
97 | regs.x.edi = FP_OFF(rmregs);
98 | regs.x.es = FP_SEG(rmregs);
99 |
100 | intr(0x31, ®s);
101 | }
102 |
103 | #endif
104 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/menus.css:
--------------------------------------------------------------------------------
1 | .menubar {
2 | padding: 0px;
3 | border: none;
4 | border: 1px menu;
5 | padding-bottom: 1px;
6 | }
7 |
8 | .menubar-button {
9 | background-color: none;
10 | border: none;
11 | }
12 |
13 | .menubar-button:down {
14 | border: 1px outset;
15 | }
16 |
17 | .menu {
18 | padding: 1px;
19 | width: 20px;
20 | margin-top: 1px;
21 | border: 1px outset;
22 | }
23 |
24 | .menu.expanded {
25 | border: 1px dropdownpopup;
26 | }
27 |
28 | .menu .menu-filler {
29 | height: 1px;
30 | border: 1px menufiller;
31 | }
32 |
33 | .menu.expanded .menu-filler {
34 | __height: 0px;
35 | __border: 1px outset;
36 | }
37 |
38 |
39 | .menuitem {
40 | width: 100%;
41 | padding: 1px;
42 | cursor: pointer;
43 | }
44 |
45 | .menu-item:hover {
46 | color: #ffffff;
47 | background-color: #000088;
48 | }
49 |
50 | .menu-item:hover .label {
51 | color: #ffffff;
52 | background-color: #000088;
53 | }
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | .menubar {
72 | background-color: white;
73 | border: none;
74 | filter: none;
75 | padding: 0px;
76 | padding-left: 1px;
77 | padding-right: 1px;
78 | filter: drop-shadow(1, 90, #888888);
79 | }
80 |
81 | .menubar .button {
82 | background-color: white;
83 | border: 1px thin white;
84 | color: #000088;
85 | filter: none;
86 | }
87 |
88 | .menubar .button:hover {
89 | background-color: #000088;
90 | border: 1px thin #000088;
91 | color: #FFFFFF;
92 | filter: none;
93 | }
94 |
95 | .menubar .button:down {
96 | background-color: #000088;
97 | border: 1px thin #000088;
98 | color: #FFFFFF;
99 | filter: none;
100 | }
101 |
102 | .menu {
103 | background-color: #000088;
104 | border: 1px thin #000088;
105 | color: #FFFFFF;
106 | filter: drop-shadow(.5, 1, #888888);
107 | }
108 |
109 | .menu-item {
110 | padding: 0px;
111 | background-color: #000088;
112 | }
113 |
114 | .menu-item .label {
115 | color: #FFFFFF;
116 | }
117 |
118 | .menu-separator {
119 | background-color: #000088;
120 | color: #FFFFFF;
121 | background-image: 'HLINE';
122 | }
123 |
--------------------------------------------------------------------------------
/lib/pdcurses/delch.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | delch
8 | -----
9 |
10 | ### Synopsis
11 |
12 | int delch(void);
13 | int wdelch(WINDOW *win);
14 | int mvdelch(int y, int x);
15 | int mvwdelch(WINDOW *win, int y, int x);
16 |
17 | ### Description
18 |
19 | The character under the cursor in the window is deleted. All
20 | characters to the right on the same line are moved to the left one
21 | position and the last character on the line is filled with a blank.
22 | The cursor position does not change (after moving to y, x if
23 | coordinates are specified).
24 |
25 | ### Return Value
26 |
27 | All functions return OK on success and ERR on error.
28 |
29 | ### Portability
30 | X/Open ncurses NetBSD
31 | delch Y Y Y
32 | wdelch Y Y Y
33 | mvdelch Y Y Y
34 | mvwdelch Y Y Y
35 |
36 | **man-end****************************************************************/
37 |
38 | #include
39 |
40 | int wdelch(WINDOW *win)
41 | {
42 | int y, x, maxx;
43 | chtype *temp1;
44 |
45 | PDC_LOG(("wdelch() - called\n"));
46 |
47 | if (!win)
48 | return ERR;
49 |
50 | y = win->_cury;
51 | x = win->_curx;
52 | maxx = win->_maxx - 1;
53 | temp1 = &win->_y[y][x];
54 |
55 | memmove(temp1, temp1 + 1, (maxx - x) * sizeof(chtype));
56 |
57 | /* wrs (4/10/93) account for window background */
58 |
59 | win->_y[y][maxx] = win->_bkgd;
60 |
61 | win->_lastch[y] = maxx;
62 |
63 | if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x))
64 | win->_firstch[y] = x;
65 |
66 | PDC_sync(win);
67 |
68 | return OK;
69 | }
70 |
71 | int delch(void)
72 | {
73 | PDC_LOG(("delch() - called\n"));
74 |
75 | return wdelch(stdscr);
76 | }
77 |
78 | int mvdelch(int y, int x)
79 | {
80 | PDC_LOG(("mvdelch() - called\n"));
81 |
82 | if (move(y, x) == ERR)
83 | return ERR;
84 |
85 | return wdelch(stdscr);
86 | }
87 |
88 | int mvwdelch(WINDOW *win, int y, int x)
89 | {
90 | PDC_LOG(("mvwdelch() - called\n"));
91 |
92 | if (wmove(win, y, x) == ERR)
93 | return ERR;
94 |
95 | return wdelch(win);
96 | }
97 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/Chars.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses;
2 |
3 | @:include("curses.h")
4 | extern class Chars {
5 | @:native("ACS_VLINE") public static var VLINE:Int;
6 | @:native("ACS_HLINE") public static var HLINE:Int;
7 | @:native("ACS_ULCORNER") public static var ULCORNER:Int;
8 | @:native("ACS_LLCORNER") public static var LLCORNER:Int;
9 | @:native("ACS_URCORNER") public static var URCORNER:Int;
10 | @:native("ACS_LRCORNER") public static var LRCORNER:Int;
11 |
12 | @:native("ACS_RTEE") public static var RTEE:Int;
13 | @:native("ACS_LTEE") public static var LTEE:Int;
14 | @:native("ACS_BTEE") public static var BTEE:Int;
15 | @:native("ACS_TTEE") public static var TTEE:Int;
16 | @:native("ACS_PLUS") public static var PLUS:Int;
17 |
18 | @:native("ACS_LARROW") public static var LARROW:Int;
19 | @:native("ACS_RARROW") public static var RARROW:Int;
20 | @:native("ACS_DARROW") public static var DARROW:Int;
21 | @:native("ACS_UARROW") public static var UARROW:Int;
22 |
23 | @:native("ACS_BLOCK") public static var BLOCK:Int;
24 | @:native("ACS_BOARD") public static var BOARD:Int;
25 | @:native("ACS_CKBOARD") public static var CKBOARD:Int;
26 | @:native("ACS_DIAMOND") public static var DIAMOND:Int;
27 | @:native("ACS_LANTERN") public static var LANTERN:Int;
28 |
29 | @:native("ACS_BULLET") public static var BULLET:Int;
30 | @:native("ACS_S3") public static var TEST:Int;
31 |
32 | // additional chars dont seem to be in the header
33 | public inline static var HALF_BLOCK_BOTTOM:Int = 220;
34 | public inline static var HALF_BLOCK_TOP:Int = 223;
35 | public inline static var SQUARE:Int = 254;
36 | public inline static var TEXTURE_LIGHT:Int = 176;
37 | public inline static var TEXTURE_MEDIUM:Int = 177;
38 | public inline static var TEXTURE_DARK:Int = 178;
39 | public inline static var SECTION_SIGN:Int = 245;
40 |
41 | public inline static var X_SMALL:Int = 120;
42 | public inline static var X_LARGE:Int = 88;
43 | public inline static var X:Int = 158;
44 |
45 | public inline static var O_SMALL:Int = 111;
46 | public inline static var O_LARGE:Int = 79;
47 | public inline static var O:Int = 111;
48 | }
49 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/scrollbars.css:
--------------------------------------------------------------------------------
1 | .scroll {
2 | color: #000088;
3 | border: none;
4 | }
5 |
6 | .scroll .button {
7 | color: #000088;
8 | filter: none;
9 | }
10 |
11 | .scroll .image {
12 | background-color: #000088;
13 | color: #ffffff;
14 | }
15 |
16 | .scroll .deinc {
17 | height: 1px;
18 | width: 1px;
19 | border: none;
20 | color: #ffffff;
21 | padding: 0;
22 | background-image: 'BLOCK'
23 | filter: none;
24 | }
25 |
26 | .scroll .deinc .image {
27 | background-color: #888888;
28 | color: #ffffff;
29 | }
30 |
31 | .scroll .inc {
32 | height: 1px;
33 | width: 1px;
34 | border: none;
35 | color: #888888;
36 | padding: 0;
37 | background-image: 'BLOCK'
38 | filter: none;
39 | }
40 |
41 | .scroll .inc .image {
42 | background-color: #888888;
43 | color: #ffffff;
44 | }
45 |
46 | /************************************************************************
47 | ** HORIZONTAL SCROLL
48 | *************************************************************************/
49 | .horizontal-scroll {
50 | height: 1px;
51 | background-color: none;
52 | color: #000080;
53 | padding: 0;
54 | background-image: 'TEXTURE_MEDIUM';
55 | }
56 |
57 | .horizontal-scroll .thumb {
58 | width: 1px;
59 | height: 1px;
60 | border: none;
61 | color: #000080;
62 | padding: 0;
63 | background-image: 'BLOCK';
64 | filter: none;
65 | }
66 |
67 | .horizontal-scroll:active .thumb {
68 | color: #0000ff;
69 | }
70 |
71 | .horizontal-scroll .deinc {
72 | icon: "LARROW";
73 | }
74 |
75 | .horizontal-scroll .inc {
76 | icon: "RARROW";
77 | }
78 |
79 | /************************************************************************
80 | ** VERTICAL SCROLL
81 | *************************************************************************/
82 | .vertical-scroll {
83 | width: 1px;
84 | background-color: none;
85 | color: #000080;
86 | padding: 0;
87 | background-image: 'TEXTURE_MEDIUM';
88 | }
89 |
90 | .vertical-scroll .thumb {
91 | width: 1px;
92 | height: 1px;
93 | border: none;
94 | color: #000080;
95 | padding: 0;
96 | background-image: 'BLOCK';
97 | filter: none;
98 | }
99 |
100 | .vertical-scroll:active .thumb {
101 | color: #0000ff;
102 | }
103 |
104 |
105 | .vertical-scroll .deinc {
106 | icon: "UARROW";
107 | }
108 |
109 | .vertical-scroll .inc {
110 | icon: "DARROW";
111 | }
112 |
--------------------------------------------------------------------------------
/lib/sdl1/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for PDCurses for SDL
2 |
3 | O = o
4 |
5 | ifndef PDCURSES_SRCDIR
6 | PDCURSES_SRCDIR = ..
7 | endif
8 |
9 | include $(PDCURSES_SRCDIR)/common/libobjs.mif
10 |
11 | osdir = $(PDCURSES_SRCDIR)/sdl1
12 |
13 | PDCURSES_SDL_H = $(osdir)/pdcsdl.h
14 |
15 | SFLAGS = $(shell sdl-config --cflags)
16 | SLIBS = $(shell sdl-config --libs)
17 |
18 | ifeq ($(DEBUG),Y)
19 | CFLAGS = -g -Wall -DPDCDEBUG -fPIC
20 | else
21 | CFLAGS = -O2 -Wall -fPIC
22 | endif
23 |
24 | ifeq ($(WIDE),Y)
25 | CFLAGS += -DPDC_WIDE
26 | SLIBS += -lSDL_ttf
27 | endif
28 |
29 | ifeq ($(UTF8),Y)
30 | CFLAGS += -DPDC_FORCE_UTF8
31 | endif
32 |
33 | BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR)
34 |
35 | LINK = $(CC)
36 | LDFLAGS = $(LIBCURSES) $(SLIBS)
37 | RANLIB = ranlib
38 | LIBCURSES = pdcurses.a
39 |
40 | DEMOS += sdltest
41 |
42 | .PHONY: all libs clean demos
43 |
44 | all: libs
45 |
46 | libs: $(LIBCURSES)
47 |
48 | clean:
49 | -rm -rf *.o trace $(LIBCURSES) $(DEMOS)
50 |
51 | demos: $(DEMOS)
52 | ifneq ($(DEBUG),Y)
53 | strip $(DEMOS)
54 | endif
55 |
56 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
57 | ar rv $@ $?
58 | -$(RANLIB) $@
59 |
60 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
61 | $(PDCOBJS) : $(PDCURSES_SDL_H)
62 | $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
63 | tui.o tuidemo.o : $(PDCURSES_CURSES_H)
64 | panel.o ptest: $(PANEL_HEADER)
65 |
66 | $(LIBOBJS) : %.o: $(srcdir)/%.c
67 | $(BUILD) -c $<
68 |
69 | $(PDCOBJS) : %.o: $(osdir)/%.c
70 | $(BUILD) $(SFLAGS) -c $<
71 |
72 | firework: $(demodir)/firework.c
73 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
74 |
75 | ozdemo: $(demodir)/ozdemo.c
76 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
77 |
78 | ptest: $(demodir)/ptest.c
79 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
80 |
81 | rain: $(demodir)/rain.c
82 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
83 |
84 | testcurs: $(demodir)/testcurs.c
85 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
86 |
87 | tuidemo: tuidemo.o tui.o
88 | $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS)
89 |
90 | worm: $(demodir)/worm.c
91 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
92 |
93 | xmas: $(demodir)/xmas.c
94 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
95 |
96 | sdltest: $(osdir)/sdltest.c
97 | $(BUILD) $(DEMOFLAGS) $(SFLAGS) -o $@ $< $(LDFLAGS)
98 |
99 | tui.o: $(demodir)/tui.c $(demodir)/tui.h
100 | $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c
101 |
102 | tuidemo.o: $(demodir)/tuidemo.c
103 | $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c
104 |
105 | include $(demodir)/nctests.mif
106 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/dialogs.css:
--------------------------------------------------------------------------------
1 | .messagebox {
2 | initial-width: 40px;
3 | }
4 |
5 | .messagebox-contents {
6 | spacing: 1px;
7 | padding: 0;
8 | padding-top: 1px;
9 | padding-bottom: 0px;
10 | }
11 |
12 | .dialog {
13 | filter: none;
14 | border: none;
15 | background-color: #000088;
16 | spacing: 0;
17 | padding: 0px;
18 | filter: drop-shadow(1, 1, #888888);
19 |
20 | border: 1px thin #000080;
21 | border-top: 1px solid #000080;
22 | border-bottom: 1px solid #000080;
23 | padding: 1px;
24 | filter: drop-shadow(.5, 1, #888888);
25 | padding-left: 0px;
26 | padding-right: 0px;
27 | }
28 |
29 | .dialog-container {
30 | spacing: 0px;
31 | }
32 |
33 | .dialog-title {
34 | padding: 0px;
35 | padding-left: 1px;
36 | border: none;
37 | background-color: #000088;
38 | padding-bottom: 1px;
39 | padding-right: 1px;
40 | }
41 |
42 | .dialog-title-label {
43 | color: white;
44 | vertical-align: top;
45 | padding: 0px;
46 | }
47 |
48 | .dialog-close-button {
49 | __hidden: true;
50 | width: 1px;
51 | height: 1px;
52 | color: white;
53 | background-color: none;
54 | __margin-top: -1px;
55 | vertical-align: top;
56 | background-image: 'X';
57 | }
58 |
59 | .dialog-content {
60 | padding: 0px;
61 | padding-left: 1px;
62 | border: none;
63 | padding-right: 2px;
64 | padding-bottom: 1px;
65 | padding-top: 1px;
66 | background-color: white;
67 | }
68 |
69 | dialog.darker-dialog .dialog-content {
70 | background-color: #c0c0c0;
71 | }
72 |
73 | .dialog-footer {
74 | padding: 0px;
75 | horizontal-align: right;
76 | border: none;
77 | spacing: 2px;
78 | }
79 |
80 | .dialog-footer-container {
81 | background-color: #000088;
82 | border: none;
83 | padding-top: 0px;
84 | padding-right: 2px;
85 | padding-bottom: 0px;
86 | }
87 |
88 | .dialog #iconImage {
89 | hidden: true;
90 | }
91 |
92 | .dialog-footer-container .button {
93 | background-color: white;
94 | border: 1px thin white;
95 | color: #000088;
96 | __filter: drop-shadow(.5, 1, #c0c0c0);
97 | }
98 |
99 | .dialog-footer-container .button:active {
100 | background-color: #0000FF;
101 | border-color: #0000FF;
102 | color: white;
103 | }
104 |
105 | .modal-background {
106 | backdrop-filter: greyscale;
107 | background-color: none;
108 | }
109 |
110 | .messagebox #messageLabel {
111 | __color: white;
112 | }
113 |
--------------------------------------------------------------------------------
/lib/pdcurses/scroll.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | scroll
8 | ------
9 |
10 | ### Synopsis
11 |
12 | int scroll(WINDOW *win);
13 | int scrl(int n);
14 | int wscrl(WINDOW *win, int n);
15 |
16 | ### Description
17 |
18 | scroll() causes the window to scroll up one line. This involves
19 | moving the lines in the window data strcture.
20 |
21 | With a positive n, scrl() and wscrl() scroll the window up n lines
22 | (line i + n becomes i); otherwise they scroll the window down n
23 | lines.
24 |
25 | For these functions to work, scrolling must be enabled via
26 | scrollok(). Note also that scrolling is not allowed if the supplied
27 | window is a pad.
28 |
29 | ### Return Value
30 |
31 | All functions return OK on success and ERR on error.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | scroll Y Y Y
36 | scrl Y Y Y
37 | wscrl Y Y Y
38 |
39 | **man-end****************************************************************/
40 |
41 | int wscrl(WINDOW *win, int n)
42 | {
43 | int i, l, dir, start, end;
44 | chtype blank, *temp;
45 |
46 | /* Check if window scrolls. Valid for window AND pad */
47 |
48 | if (!win || !win->_scroll || !n)
49 | return ERR;
50 |
51 | blank = win->_bkgd;
52 |
53 | if (n > 0)
54 | {
55 | start = win->_tmarg;
56 | end = win->_bmarg;
57 | dir = 1;
58 | }
59 | else
60 | {
61 | start = win->_bmarg;
62 | end = win->_tmarg;
63 | dir = -1;
64 | }
65 |
66 | for (l = 0; l < (n * dir); l++)
67 | {
68 | temp = win->_y[start];
69 |
70 | /* re-arrange line pointers */
71 |
72 | for (i = start; i != end; i += dir)
73 | win->_y[i] = win->_y[i + dir];
74 |
75 | win->_y[end] = temp;
76 |
77 | /* make a blank line */
78 |
79 | for (i = 0; i < win->_maxx; i++)
80 | *temp++ = blank;
81 | }
82 |
83 | touchline(win, win->_tmarg, win->_bmarg - win->_tmarg + 1);
84 |
85 | PDC_sync(win);
86 | return OK;
87 | }
88 |
89 | int scrl(int n)
90 | {
91 | PDC_LOG(("scrl() - called\n"));
92 |
93 | return wscrl(stdscr, n);
94 | }
95 |
96 | int scroll(WINDOW *win)
97 | {
98 | PDC_LOG(("scroll() - called\n"));
99 |
100 | return wscrl(win, 1);
101 | }
102 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/ppm/PPMImage.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses.ppm;
2 | import haxe.ui.backend.pdcurses.Chars;
3 |
4 | class PPMImage {
5 | public var width:Int;
6 | public var height:Int;
7 | public var data:Array;
8 |
9 | public var char:Int = Chars.BLOCK;
10 |
11 | public function new() {
12 | }
13 |
14 | public function loadFromString(s:String) {
15 |
16 | var temp = s.split("\n");
17 | var lines = [];
18 | for (line in temp) {
19 | line = StringTools.trim(line);
20 | if (line.length == 0) {
21 | continue;
22 | }
23 | if (StringTools.startsWith(line, "#")) {
24 | continue;
25 | }
26 |
27 | lines.push(line);
28 | }
29 |
30 | var magic = lines.shift();
31 | if (magic != "P3") {
32 | return;
33 | }
34 |
35 | var dimensions = lines.shift().split(" ");
36 | width = Std.parseInt(dimensions[0]);
37 | height = Std.parseInt(dimensions[1]);
38 |
39 | lines.shift();
40 |
41 | data = [];
42 | var parts = [];
43 |
44 | for (line in lines) {
45 | var items = line.split(" ");
46 | for (item in items) {
47 | item = StringTools.trim(item);
48 | if (item.length == 0) {
49 | continue;
50 | }
51 | parts.push(item);
52 | }
53 | }
54 |
55 | var n = 0;
56 | var r = 0, g = 0, b = 0;
57 | for (part in parts) {
58 | if (n == 0) {
59 | r = Std.parseInt(part);
60 | } else if (n == 1) {
61 | g = Std.parseInt(part);
62 | } else if (n == 2) {
63 | b = Std.parseInt(part);
64 | }
65 | n++;
66 | if (n == 3) {
67 | data.push(Color.toANSI(r, g, b));
68 | n = 0;
69 | }
70 | }
71 | }
72 |
73 | public static function fromString(s:String):PPMImage {
74 | var i = new PPMImage();
75 | i.loadFromString(s);
76 | return i;
77 | }
78 |
79 | public static function fromChar(s:String):PPMImage {
80 | if (Image.charFromString(s) == -1) {
81 | return null;
82 | }
83 | var i = new PPMImage();
84 | i.width = 1;
85 | i.height = 1;
86 | i.char = Image.charFromString(s);
87 | i.data = [-1];
88 | return i;
89 | }
90 | }
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/_module/styles/default/steppers.css:
--------------------------------------------------------------------------------
1 | .number-stepper {
2 | padding: 0px;
3 | height: auto;
4 | initial-width: 11px;
5 | border: 1px single #000080;
6 | filter: none;
7 | background-color: none;
8 | }
9 |
10 | .number-stepper:active {
11 | border-color: #0000ff;
12 | }
13 |
14 | .number-stepper .stepper-value {
15 | text-align: center;
16 | border: none;
17 | background-color: none;
18 | filter: none;
19 | margin-top: 0px;
20 | color: #000080;
21 | }
22 |
23 | .number-stepper .stepper-deinc {
24 | icon: 'LARROW';
25 | padding-left: 0;
26 | padding-right: 0;
27 | border: none;
28 | background-color: none;
29 | color: #000080;
30 | filter: none;
31 | width: 1px;
32 | height: 1px;
33 | }
34 |
35 | .number-stepper .stepper-deinc .image {
36 | color: #000080;
37 | }
38 |
39 | .number-stepper .stepper-inc {
40 | icon: 'RARROW';
41 | padding-left: 0;
42 | padding-right: 0;
43 | border: none;
44 | background-color: none;
45 | color: #000080;
46 | filter: none;
47 | width: 1px;
48 | height: 1px;
49 | }
50 |
51 | .number-stepper .stepper-inc .image {
52 | color: #000080;
53 | }
54 |
55 | /************************************************************************
56 | ** OPTION STEPPER
57 | *************************************************************************/
58 | .option-stepper {
59 | padding: 0px;
60 | height: auto;
61 | initial-width: 16px;
62 | border: 1px single #000080;
63 | filter: none;
64 | background-color: none;
65 | }
66 |
67 | .option-stepper:active {
68 | border-color: #0000ff;
69 | }
70 |
71 | .option-stepper .stepper-value {
72 | text-align: center;
73 | border: none;
74 | background-color: none;
75 | filter: none;
76 | margin-top: 0px;
77 | padding: 1px;
78 | color: #000080;
79 | }
80 |
81 | .option-stepper .stepper-deinc {
82 | icon: 'LARROW';
83 | padding-left: 0;
84 | padding-right: 0;
85 | border: none;
86 | background-color: none;
87 | color: #000080;
88 | filter: none;
89 | width: 1px;
90 | height: 1px;
91 | }
92 |
93 | .option-stepper .stepper-deinc .image {
94 | color: #000080;
95 | }
96 |
97 | .option-stepper .stepper-inc {
98 | icon: 'RARROW';
99 | padding-left: 0;
100 | padding-right: 0;
101 | border: none;
102 | background-color: none;
103 | color: #000080;
104 | filter: none;
105 | width: 1px;
106 | height: 1px;
107 | }
108 |
109 | .option-stepper .stepper-inc .image {
110 | color: #000080;
111 | }
112 |
--------------------------------------------------------------------------------
/lib/wincon/Makefile:
--------------------------------------------------------------------------------
1 | # GNU Makefile for PDCurses - Windows console
2 | #
3 | # Usage: make [-f path\Makefile] [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y]
4 | # [INFOEX=N] [tgt]
5 | #
6 | # where tgt can be any of:
7 | # [all|demos|pdcurses.a|testcurs.exe...]
8 |
9 | O = o
10 | E = .exe
11 |
12 | ifeq ($(OS),Windows_NT)
13 | RM = cmd /c del
14 | else
15 | RM = rm -f
16 | endif
17 |
18 | ifndef PDCURSES_SRCDIR
19 | PDCURSES_SRCDIR = ..
20 | endif
21 |
22 | osdir = $(PDCURSES_SRCDIR)/wincon
23 | common = $(PDCURSES_SRCDIR)/common
24 |
25 | include $(common)/libobjs.mif
26 |
27 | PDCURSES_WIN_H = $(osdir)/pdcwin.h
28 |
29 | CC = gcc
30 | AR = ar
31 | STRIP = strip
32 | LINK = gcc
33 | WINDRES = windres
34 |
35 | ifeq ($(DEBUG),Y)
36 | CFLAGS = -g -Wall -DPDCDEBUG
37 | LDFLAGS = -g
38 | else
39 | CFLAGS = -O2 -Wall
40 | LDFLAGS =
41 | endif
42 |
43 | CFLAGS += -I$(PDCURSES_SRCDIR)
44 |
45 | ifeq ($(WIDE),Y)
46 | CFLAGS += -DPDC_WIDE
47 | endif
48 |
49 | ifeq ($(UTF8),Y)
50 | CFLAGS += -DPDC_FORCE_UTF8
51 | endif
52 |
53 | ifeq ($(DLL),Y)
54 | CFLAGS += -DPDC_DLL_BUILD
55 | LIBEXE = $(CC)
56 | LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o
57 | LIBCURSES = pdcurses.dll
58 | CLEAN = $(LIBCURSES) *.a
59 | RESOURCE = pdcurses.o
60 | else
61 | LIBEXE = $(AR)
62 | LIBFLAGS = rcv
63 | LIBCURSES = pdcurses.a
64 | CLEAN = *.a
65 | endif
66 |
67 | ifeq ($(INFOEX),N)
68 | CFLAGS += -DHAVE_NO_INFOEX
69 | endif
70 |
71 | .PHONY: all libs clean demos dist
72 |
73 | all: libs
74 |
75 | libs: $(LIBCURSES)
76 |
77 | clean:
78 | -$(RM) *.o
79 | -$(RM) *.exe
80 | -$(RM) $(CLEAN)
81 |
82 | demos: $(DEMOS)
83 | ifneq ($(DEBUG),Y)
84 | $(STRIP) *.exe
85 | endif
86 |
87 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(RESOURCE)
88 | $(LIBEXE) $(LIBFLAGS) $@ $?
89 |
90 | pdcurses.o: $(common)/pdcurses.rc
91 | $(WINDRES) -i $(common)/pdcurses.rc pdcurses.o
92 |
93 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
94 | $(PDCOBJS) : $(PDCURSES_WIN_H)
95 | $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
96 | panel.o : $(PANEL_HEADER)
97 |
98 | $(LIBOBJS) : %.o: $(srcdir)/%.c
99 | $(CC) -c $(CFLAGS) $<
100 |
101 | $(PDCOBJS) : %.o: $(osdir)/%.c
102 | $(CC) -c $(CFLAGS) $<
103 |
104 | firework.exe ozdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \
105 | ptest.exe: %.exe: $(demodir)/%.c
106 | $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES)
107 |
108 | tuidemo.exe: tuidemo.o tui.o
109 | $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES)
110 |
111 | tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H)
112 | $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
113 |
114 | tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H)
115 | $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $<
116 |
--------------------------------------------------------------------------------
/lib/wincon/README.md:
--------------------------------------------------------------------------------
1 | PDCurses for Windows console
2 | ============================
3 |
4 | This directory contains PDCurses source code files specific to the
5 | Microsoft Windows console. Although historically called "Win32", this
6 | port can just as easily be built for 64-bit systems. Windows 95 through
7 | Windows 10 are covered. (Some features require later versions.)
8 |
9 |
10 | Building
11 | --------
12 |
13 | - Choose the appropriate makefile for your compiler:
14 |
15 | Makefile - GCC (MinGW or Cygnus)
16 | Makefile.bcc - Borland C++
17 | Makefile.vc - Microsoft Visual C++
18 | Makefile.wcc - Watcom
19 |
20 | - Optionally, you can build in a different directory than the platform
21 | directory by setting PDCURSES_SRCDIR to point to the directory where
22 | you unpacked PDCurses, and changing to your target directory:
23 |
24 | set PDCURSES_SRCDIR=c:\pdcurses
25 |
26 | - Build it:
27 |
28 | make -f makefilename
29 |
30 | (For Watcom, use "wmake" instead of "make"; for MSVC, "nmake"; for
31 | MinGW, "mingw32-make".) You'll get the library (pdcurses.lib or .a,
32 | depending on your compiler) and a lot of object files.
33 |
34 | You can also give the optional parameter "WIDE=Y", to build the
35 | library with wide-character (Unicode) support:
36 |
37 | wmake -f Makefile.wcc WIDE=Y
38 |
39 | When built this way, the library is not compatible with Windows 9x,
40 | unless you also link with the Microsoft Layer for Unicode (not
41 | tested).
42 |
43 | Another option, "UTF8=Y", makes PDCurses ignore the system locale, and
44 | treat all narrow-character strings as UTF-8. This option has no effect
45 | unless WIDE=Y is also set. Use it to get around the poor support for
46 | UTF-8 in the Windows console:
47 |
48 | make -f Makefile.bcc WIDE=Y UTF8=Y
49 |
50 | You can also use the optional parameter "DLL=Y" with Visual C++,
51 | MinGW or Cygwin, to build the library as a DLL:
52 |
53 | nmake -f Makefile.vc WIDE=Y DLL=Y
54 |
55 | When you build the library as a Windows DLL, you must always define
56 | PDC_DLL_BUILD when linking against it. (Or, if you only want to use
57 | the DLL, you could add this definition to your curses.h.)
58 |
59 | Add the target "demos" to build the sample programs.
60 |
61 | - If your build stops with errors about PCONSOLE_SCREEN_BUFFER_INFOEX,
62 | add the parameter "INFOEX=N" to your make command line and try again.
63 | (This will happen with older compile environments.)
64 |
65 |
66 | Distribution Status
67 | -------------------
68 |
69 | The files in this directory are released to the public domain.
70 |
71 |
72 | Acknowledgements
73 | ----------------
74 |
75 | Windows console port was originally provided by Chris Szurgot
76 |
77 |
--------------------------------------------------------------------------------
/lib/sdl2/pdcclip.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | #include
6 | #include
7 |
8 | /*man-start**************************************************************
9 |
10 | clipboard
11 | ---------
12 |
13 | ### Synopsis
14 |
15 | int PDC_getclipboard(char **contents, long *length);
16 | int PDC_setclipboard(const char *contents, long length);
17 | int PDC_freeclipboard(char *contents);
18 | int PDC_clearclipboard(void);
19 |
20 | ### Description
21 |
22 | PDC_getclipboard() gets the textual contents of the system's
23 | clipboard. This function returns the contents of the clipboard in the
24 | contents argument. It is the responsibility of the caller to free the
25 | memory returned, via PDC_freeclipboard(). The length of the clipboard
26 | contents is returned in the length argument.
27 |
28 | PDC_setclipboard copies the supplied text into the system's
29 | clipboard, emptying the clipboard prior to the copy.
30 |
31 | PDC_clearclipboard() clears the internal clipboard.
32 |
33 | ### Return Values
34 |
35 | indicator of success/failure of call.
36 | PDC_CLIP_SUCCESS the call was successful
37 | PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
38 | the clipboard contents
39 | PDC_CLIP_EMPTY the clipboard contains no text
40 | PDC_CLIP_ACCESS_ERROR no clipboard support
41 |
42 | ### Portability
43 | X/Open ncurses NetBSD
44 | PDC_getclipboard - - -
45 | PDC_setclipboard - - -
46 | PDC_freeclipboard - - -
47 | PDC_clearclipboard - - -
48 |
49 | **man-end****************************************************************/
50 |
51 | int PDC_getclipboard(char **contents, long *length)
52 | {
53 | PDC_LOG(("PDC_getclipboard() - called\n"));
54 |
55 | if (SDL_HasClipboardText() == SDL_FALSE)
56 | return PDC_CLIP_EMPTY;
57 | *contents = SDL_GetClipboardText();
58 | *length = strlen(*contents);
59 |
60 | return PDC_CLIP_SUCCESS;
61 | }
62 |
63 | int PDC_setclipboard(const char *contents, long length)
64 | {
65 | PDC_LOG(("PDC_setclipboard() - called\n"));
66 |
67 | if (SDL_SetClipboardText(contents) != 0)
68 | return PDC_CLIP_ACCESS_ERROR;
69 |
70 | return PDC_CLIP_SUCCESS;
71 | }
72 |
73 | int PDC_freeclipboard(char *contents)
74 | {
75 | PDC_LOG(("PDC_freeclipboard() - called\n"));
76 |
77 | SDL_free(contents);
78 |
79 | return PDC_CLIP_SUCCESS;
80 | }
81 |
82 | int PDC_clearclipboard(void)
83 | {
84 | PDC_LOG(("PDC_clearclipboard() - called\n"));
85 |
86 | if (SDL_HasClipboardText() == SDL_TRUE)
87 | {
88 | SDL_SetClipboardText(NULL);
89 | }
90 |
91 | return PDC_CLIP_SUCCESS;
92 | }
93 |
--------------------------------------------------------------------------------
/lib/sdl1/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | /*man-start**************************************************************
6 |
7 | pdcsetsc
8 | --------
9 |
10 | ### Synopsis
11 |
12 | int PDC_set_blink(bool blinkon);
13 | int PDC_set_bold(bool boldon);
14 | void PDC_set_title(const char *title);
15 |
16 | ### Description
17 |
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
19 | blink mode (TRUE), or sets the background color to high intensity
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It
21 | returns OK if it could set the state to match the given parameter,
22 | ERR otherwise.
23 |
24 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
25 | bold font (TRUE), or sets the foreground color to high intensity
26 | (FALSE). It returns OK if it could set the state to match the given
27 | parameter, ERR otherwise.
28 |
29 | PDC_set_title() sets the title of the window in which the curses
30 | program is running. This function may not do anything on some
31 | platforms.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | PDC_set_blink - - -
36 | PDC_set_title - - -
37 |
38 | **man-end****************************************************************/
39 |
40 | int PDC_curs_set(int visibility)
41 | {
42 | int ret_vis;
43 |
44 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
45 |
46 | ret_vis = SP->visibility;
47 |
48 | SP->visibility = visibility;
49 |
50 | PDC_gotoyx(SP->cursrow, SP->curscol);
51 |
52 | return ret_vis;
53 | }
54 |
55 | void PDC_set_title(const char *title)
56 | {
57 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
58 |
59 | SDL_WM_SetCaption(title, title);
60 | }
61 |
62 | int PDC_set_blink(bool blinkon)
63 | {
64 | if (!SP)
65 | return ERR;
66 |
67 | if (SP->color_started)
68 | COLORS = PDC_MAXCOL;
69 |
70 | if (blinkon)
71 | {
72 | if (!(SP->termattrs & A_BLINK))
73 | {
74 | SP->termattrs |= A_BLINK;
75 | PDC_blink_text();
76 | }
77 | }
78 | else
79 | {
80 | if (SP->termattrs & A_BLINK)
81 | {
82 | SP->termattrs &= ~A_BLINK;
83 | PDC_blink_text();
84 | }
85 | }
86 |
87 | return OK;
88 | }
89 |
90 | int PDC_set_bold(bool boldon)
91 | {
92 | if (!SP)
93 | return ERR;
94 |
95 | #ifdef PDC_WIDE
96 | if (boldon)
97 | SP->termattrs |= A_BOLD;
98 | else
99 | SP->termattrs &= ~A_BOLD;
100 |
101 | return OK;
102 | #else
103 | return boldon ? ERR : OK;
104 | #endif
105 | }
106 |
--------------------------------------------------------------------------------
/lib/sdl2/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | /*man-start**************************************************************
6 |
7 | pdcsetsc
8 | --------
9 |
10 | ### Synopsis
11 |
12 | int PDC_set_blink(bool blinkon);
13 | int PDC_set_bold(bool boldon);
14 | void PDC_set_title(const char *title);
15 |
16 | ### Description
17 |
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
19 | blink mode (TRUE), or sets the background color to high intensity
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It
21 | returns OK if it could set the state to match the given parameter,
22 | ERR otherwise.
23 |
24 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
25 | bold font (TRUE), or sets the foreground color to high intensity
26 | (FALSE). It returns OK if it could set the state to match the given
27 | parameter, ERR otherwise.
28 |
29 | PDC_set_title() sets the title of the window in which the curses
30 | program is running. This function may not do anything on some
31 | platforms.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | PDC_set_blink - - -
36 | PDC_set_title - - -
37 |
38 | **man-end****************************************************************/
39 |
40 | int PDC_curs_set(int visibility)
41 | {
42 | int ret_vis;
43 |
44 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
45 |
46 | ret_vis = SP->visibility;
47 |
48 | SP->visibility = visibility;
49 |
50 | PDC_gotoyx(SP->cursrow, SP->curscol);
51 |
52 | return ret_vis;
53 | }
54 |
55 | void PDC_set_title(const char *title)
56 | {
57 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
58 |
59 | SDL_SetWindowTitle(pdc_window, title);
60 | }
61 |
62 | int PDC_set_blink(bool blinkon)
63 | {
64 | if (!SP)
65 | return ERR;
66 |
67 | if (SP->color_started)
68 | COLORS = PDC_MAXCOL;
69 |
70 | if (blinkon)
71 | {
72 | if (!(SP->termattrs & A_BLINK))
73 | {
74 | SP->termattrs |= A_BLINK;
75 | PDC_blink_text();
76 | }
77 | }
78 | else
79 | {
80 | if (SP->termattrs & A_BLINK)
81 | {
82 | SP->termattrs &= ~A_BLINK;
83 | PDC_blink_text();
84 | }
85 | }
86 |
87 | return OK;
88 | }
89 |
90 | int PDC_set_bold(bool boldon)
91 | {
92 | if (!SP)
93 | return ERR;
94 |
95 | #ifdef PDC_WIDE
96 | if (boldon)
97 | SP->termattrs |= A_BOLD;
98 | else
99 | SP->termattrs &= ~A_BOLD;
100 |
101 | return OK;
102 | #else
103 | return boldon ? ERR : OK;
104 | #endif
105 | }
106 |
--------------------------------------------------------------------------------
/lib/x11/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcx11.h"
4 |
5 | #include
6 |
7 | /*man-start**************************************************************
8 |
9 | pdcsetsc
10 | --------
11 |
12 | ### Synopsis
13 |
14 | int PDC_set_blink(bool blinkon);
15 | int PDC_set_bold(bool boldon);
16 | void PDC_set_title(const char *title);
17 |
18 | ### Description
19 |
20 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
21 | blink mode (TRUE), or sets the background color to high intensity
22 | (FALSE). The default is platform-dependent (FALSE in most cases). It
23 | returns OK if it could set the state to match the given parameter,
24 | ERR otherwise.
25 |
26 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
27 | bold font (TRUE), or sets the foreground color to high intensity
28 | (FALSE). It returns OK if it could set the state to match the given
29 | parameter, ERR otherwise.
30 |
31 | PDC_set_title() sets the title of the window in which the curses
32 | program is running. This function may not do anything on some
33 | platforms.
34 |
35 | ### Portability
36 | X/Open ncurses NetBSD
37 | PDC_set_blink - - -
38 | PDC_set_title - - -
39 |
40 | **man-end****************************************************************/
41 |
42 | int PDC_curs_set(int visibility)
43 | {
44 | int ret_vis = SP->visibility;
45 |
46 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
47 |
48 | if (visibility != -1)
49 | SP->visibility = visibility;
50 |
51 | PDC_display_cursor(SP->cursrow, SP->curscol, SP->cursrow,
52 | SP->curscol, visibility);
53 |
54 | return ret_vis;
55 | }
56 |
57 | void PDC_set_title(const char *title)
58 | {
59 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
60 |
61 | XtVaSetValues(pdc_toplevel, XtNtitle, title, NULL);
62 | }
63 |
64 | int PDC_set_blink(bool blinkon)
65 | {
66 | if (!SP)
67 | return ERR;
68 |
69 | if (SP->color_started)
70 | COLORS = PDC_MAXCOL;
71 |
72 | if (blinkon)
73 | {
74 | if (!(SP->termattrs & A_BLINK))
75 | {
76 | SP->termattrs |= A_BLINK;
77 | pdc_blinked_off = FALSE;
78 | XtAppAddTimeOut(pdc_app_context, pdc_app_data.textBlinkRate,
79 | PDC_blink_text, NULL);
80 | }
81 | }
82 | else
83 | SP->termattrs &= ~A_BLINK;
84 |
85 | return OK;
86 | }
87 |
88 | int PDC_set_bold(bool boldon)
89 | {
90 | if (!SP)
91 | return ERR;
92 |
93 | if (boldon)
94 | SP->termattrs |= A_BOLD;
95 | else
96 | SP->termattrs &= ~A_BOLD;
97 |
98 | return OK;
99 | }
100 |
--------------------------------------------------------------------------------
/haxe/ui/backend/pdcurses/Image.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend.pdcurses;
2 |
3 | class Image {
4 | public static function charFromString(s:String):Int {
5 | switch (s) {
6 | case "VLINE": return Chars.VLINE;
7 | case "HLINE": return Chars.HLINE;
8 | case "ULCORNER": return Chars.ULCORNER;
9 | case "LLCORNER": return Chars.LLCORNER;
10 | case "URCORNER": return Chars.URCORNER;
11 | case "LRCORNER": return Chars.LRCORNER;
12 |
13 | case "RTEE": return Chars.RTEE;
14 | case "LTEE": return Chars.LTEE;
15 | case "BTEE": return Chars.BTEE;
16 | case "TTEE": return Chars.TTEE;
17 | case "PLUS": return Chars.PLUS;
18 |
19 | case "LARROW": return Chars.LARROW;
20 | case "RARROW": return Chars.RARROW;
21 | case "DARROW": return Chars.DARROW;
22 | case "UARROW": return Chars.UARROW;
23 |
24 | case "LTRIANGLE": return 17;
25 | case "RTRIANGLE": return 16;
26 | case "DTRIANGLE": return 31;
27 | case "UTRIANGLE": return 30;
28 |
29 | case "BLOCK": return Chars.BLOCK;
30 | case "BOARD": return Chars.BOARD;
31 | case "CKBOARD": return Chars.CKBOARD;
32 | case "DIAMOND": return Chars.DIAMOND;
33 | case "LANTERN": return Chars.LANTERN;
34 |
35 | case "BULLET": return Chars.BULLET;
36 | case "TEST": return Chars.TEST;
37 |
38 | case "HALF_BLOCK_BOTTOM": return Chars.HALF_BLOCK_BOTTOM;
39 | case "HALF_BLOCK_TOP": return Chars.HALF_BLOCK_TOP;
40 | case "SQUARE": return Chars.SQUARE;
41 | case "TEXTURE_LIGHT": return Chars.TEXTURE_LIGHT;
42 | case "TEXTURE_MEDIUM": return Chars.TEXTURE_MEDIUM;
43 | case "TEXTURE_DARK": return Chars.TEXTURE_DARK;
44 | case "SECTION_SIGN": return Chars.SECTION_SIGN;
45 | case "X": return Chars.X;
46 | case "X_SMALL": return Chars.X_SMALL;
47 | case "X_LARGE": return Chars.X_LARGE;
48 | case "O": return Chars.O;
49 | case "O_SMALL": return Chars.O_SMALL;
50 | case "O_LARGE": return Chars.O_LARGE;
51 | }
52 | return -1;
53 | }
54 |
55 | public static function isCharImage(c:Int) {
56 | return (c == Chars.LARROW || c == Chars.RARROW || c == Chars.UARROW || c == Chars.DARROW);
57 | }
58 | }
--------------------------------------------------------------------------------
/lib/wincon/Makefile.vc:
--------------------------------------------------------------------------------
1 | # Visual C++ Makefile for PDCurses - Windows console
2 | #
3 | # Usage: nmake -f [path\]Makefile.vc [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y]
4 | # [INFOEX=N] [target]
5 | #
6 | # where target can be any of:
7 | # [all|demos|pdcurses.lib|testcurs.exe...]
8 |
9 | O = obj
10 | E = .exe
11 | RM = del
12 |
13 | !ifndef PDCURSES_SRCDIR
14 | PDCURSES_SRCDIR = ..
15 | !endif
16 |
17 | !include $(PDCURSES_SRCDIR)\common\libobjs.mif
18 |
19 | osdir = $(PDCURSES_SRCDIR)\wincon
20 | common = $(PDCURSES_SRCDIR)\common
21 |
22 | PDCURSES_WIN_H = $(osdir)\pdcwin.h
23 |
24 | CC = cl.exe -nologo
25 |
26 | !ifdef DEBUG
27 | CFLAGS = -Z7 -DPDCDEBUG
28 | LDFLAGS = -debug -pdb:none
29 | !else
30 | CFLAGS = -O1
31 | LDFLAGS =
32 | !endif
33 |
34 | !ifdef WIDE
35 | WIDEOPT = -DPDC_WIDE
36 | !endif
37 |
38 | !ifdef UTF8
39 | UTF8OPT = -DPDC_FORCE_UTF8
40 | !endif
41 |
42 | !ifdef INFOEX
43 | INFOPT = -DHAVE_NO_INFOEX
44 | !endif
45 |
46 | SHL_LD = link $(LDFLAGS) -nologo -dll -machine:$(PLATFORM) -out:pdcurses.dll
47 |
48 | LINK = link.exe -nologo
49 |
50 | CCLIBS = user32.lib advapi32.lib
51 | # may need to add msvcrt for older compilers
52 | #CCLIBS = msvcrt.lib user32.lib advapi32.lib
53 |
54 | LIBEXE = lib -nologo
55 |
56 | LIBCURSES = pdcurses.lib
57 | CURSESDLL = pdcurses.dll
58 |
59 | !ifdef DLL
60 | DLLOPT = -DPDC_DLL_BUILD
61 | PDCLIBS = $(CURSESDLL)
62 | !else
63 | PDCLIBS = $(LIBCURSES)
64 | !endif
65 |
66 | BUILD = $(CC) -I$(PDCURSES_SRCDIR) -c $(CFLAGS) $(DLLOPT) \
67 | $(WIDEOPT) $(UTF8OPT) $(INFOPT)
68 |
69 | all: $(PDCLIBS)
70 |
71 | clean:
72 | -$(RM) *.obj
73 | -$(RM) *.lib
74 | -$(RM) *.exe
75 | -$(RM) *.dll
76 | -$(RM) *.exp
77 | -$(RM) *.res
78 |
79 | demos: $(PDCLIBS) $(DEMOS)
80 |
81 | DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj
82 |
83 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
84 | $(PDCOBJS) : $(PDCURSES_WIN_H)
85 | $(DEMOOBJS) : $(PDCURSES_CURSES_H)
86 | $(DEMOS) : $(LIBCURSES)
87 | panel.obj : $(PANEL_HEADER)
88 |
89 | !ifndef DLL
90 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
91 | $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS)
92 | !endif
93 |
94 | $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj
95 | $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(CCLIBS)
96 |
97 | pdcurses.res pdcurses.obj: $(common)\pdcurses.rc
98 | rc -r -fopdcurses.res $(common)\pdcurses.rc
99 | cvtres -machine:$(PLATFORM) -nologo -out:pdcurses.obj pdcurses.res
100 |
101 | {$(srcdir)\}.c{}.obj::
102 | $(BUILD) $<
103 |
104 | {$(osdir)\}.c{}.obj::
105 | $(BUILD) $<
106 |
107 | {$(demodir)\}.c{}.obj::
108 | $(BUILD) $<
109 |
110 | .obj.exe:
111 | $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS)
112 |
113 | tuidemo.exe: tuidemo.obj tui.obj
114 | $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS)
115 |
116 | tui.obj: $(demodir)\tui.c $(demodir)\tui.h
117 | $(BUILD) -I$(demodir) $(demodir)\tui.c
118 |
119 | tuidemo.obj: $(demodir)\tuidemo.c
120 | $(BUILD) -I$(demodir) $(demodir)\tuidemo.c
121 |
--------------------------------------------------------------------------------
/lib/pdcurses/debug.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | debug
8 | -----
9 |
10 | ### Synopsis
11 |
12 | void traceon(void);
13 | void traceoff(void);
14 | void PDC_debug(const char *, ...);
15 |
16 | ### Description
17 |
18 | traceon() and traceoff() toggle the recording of debugging
19 | information to the file "trace". Although not standard, similar
20 | functions are in some other curses implementations.
21 |
22 | PDC_debug() is the function that writes to the file, based on whether
23 | traceon() has been called. It's used from the PDC_LOG() macro.
24 |
25 | The environment variable PDC_TRACE_FLUSH controls whether the trace
26 | file contents are fflushed after each write. The default is not. Set
27 | it to enable this (may affect performance).
28 |
29 | ### Portability
30 | X/Open ncurses NetBSD
31 | traceon - - -
32 | traceoff - - -
33 | PDC_debug - - -
34 |
35 | **man-end****************************************************************/
36 |
37 | #include
38 | #include
39 | #include
40 | #include
41 |
42 | static bool want_fflush = FALSE;
43 |
44 | void PDC_debug(const char *fmt, ...)
45 | {
46 | va_list args;
47 | char hms[9];
48 | time_t now;
49 |
50 | if (!SP || !SP->dbfp)
51 | return;
52 |
53 | time(&now);
54 | strftime(hms, 9, "%H:%M:%S", localtime(&now));
55 | fprintf(SP->dbfp, "At: %8.8ld - %s ", (long) clock(), hms);
56 |
57 | va_start(args, fmt);
58 | vfprintf(SP->dbfp, fmt, args);
59 | va_end(args);
60 |
61 | /* If you are crashing and losing debugging information, enable this
62 | by setting the environment variable PDC_TRACE_FLUSH. This may
63 | impact performance. */
64 |
65 | if (want_fflush)
66 | fflush(SP->dbfp);
67 |
68 | /* If with PDC_TRACE_FLUSH enabled you are still losing logging in
69 | crashes, you may need to add a platform-dependent mechanism to
70 | flush the OS buffers as well (such as fsync() on POSIX) -- but
71 | expect terrible performance. */
72 | }
73 |
74 | void traceon(void)
75 | {
76 | if (!SP)
77 | return;
78 |
79 | if (SP->dbfp)
80 | fclose(SP->dbfp);
81 |
82 | /* open debug log file append */
83 | SP->dbfp = fopen("trace", "a");
84 | if (!SP->dbfp)
85 | {
86 | fprintf(stderr, "PDC_debug(): Unable to open debug log file\n");
87 | return;
88 | }
89 |
90 | if (getenv("PDC_TRACE_FLUSH"))
91 | want_fflush = TRUE;
92 |
93 | PDC_LOG(("traceon() - called\n"));
94 | }
95 |
96 | void traceoff(void)
97 | {
98 | if (!SP || !SP->dbfp)
99 | return;
100 |
101 | PDC_LOG(("traceoff() - called\n"));
102 |
103 | fclose(SP->dbfp);
104 | SP->dbfp = NULL;
105 | want_fflush = FALSE;
106 | }
107 |
--------------------------------------------------------------------------------
/lib/os2/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcos2.h"
4 |
5 | /*man-start**************************************************************
6 |
7 | pdcsetsc
8 | --------
9 |
10 | ### Synopsis
11 |
12 | int PDC_set_blink(bool blinkon);
13 | int PDC_set_bold(bool boldon);
14 | void PDC_set_title(const char *title);
15 |
16 | ### Description
17 |
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
19 | blink mode (TRUE), or sets the background color to high intensity
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It
21 | returns OK if it could set the state to match the given parameter,
22 | ERR otherwise.
23 |
24 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
25 | bold font (TRUE), or sets the foreground color to high intensity
26 | (FALSE). It returns OK if it could set the state to match the given
27 | parameter, ERR otherwise.
28 |
29 | PDC_set_title() sets the title of the window in which the curses
30 | program is running. This function may not do anything on some
31 | platforms.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | PDC_set_blink - - -
36 | PDC_set_title - - -
37 |
38 | **man-end****************************************************************/
39 |
40 | int PDC_curs_set(int visibility)
41 | {
42 | VIOCURSORINFO pvioCursorInfo;
43 | int ret_vis, hidden = 0, start = 0, end = 0;
44 |
45 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
46 |
47 | ret_vis = SP->visibility;
48 | SP->visibility = visibility;
49 |
50 | switch(visibility)
51 | {
52 | case 0: /* invisible */
53 | start = pdc_font / 4;
54 | end = pdc_font;
55 | hidden = -1;
56 | break;
57 |
58 | case 2: /* highly visible */
59 | start = 2; /* almost full-height block */
60 | end = pdc_font - 1;
61 | break;
62 |
63 | default: /* normal visibility */
64 | start = (SP->orig_cursor >> 8) & 0xff;
65 | end = SP->orig_cursor & 0xff;
66 | }
67 |
68 | pvioCursorInfo.yStart = (USHORT)start;
69 | pvioCursorInfo.cEnd = (USHORT)end;
70 | pvioCursorInfo.cx = (USHORT)1;
71 | pvioCursorInfo.attr = hidden;
72 | VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0);
73 |
74 | return ret_vis;
75 | }
76 |
77 | void PDC_set_title(const char *title)
78 | {
79 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
80 | }
81 |
82 | int PDC_set_blink(bool blinkon)
83 | {
84 | if (!SP)
85 | return ERR;
86 |
87 | if (SP->color_started)
88 | COLORS = 16;
89 |
90 | if (blinkon)
91 | {
92 | if (!(SP->termattrs & A_BLINK))
93 | {
94 | SP->termattrs |= A_BLINK;
95 | pdc_last_blink = PDC_ms_count();
96 | }
97 | }
98 | else
99 | {
100 | if (SP->termattrs & A_BLINK)
101 | {
102 | SP->termattrs &= ~A_BLINK;
103 | PDC_blink_text();
104 | }
105 | }
106 |
107 | return OK;
108 | }
109 |
110 | int PDC_set_bold(bool boldon)
111 | {
112 | return boldon ? ERR : OK;
113 | }
114 |
--------------------------------------------------------------------------------
/lib/os2/pdcdisp.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcos2.h"
4 | #include "../common/acs437.h"
5 |
6 | ULONG pdc_last_blink;
7 | static bool blinked_off = FALSE;
8 |
9 | /* position hardware cursor at (y, x) */
10 |
11 | void PDC_gotoyx(int row, int col)
12 | {
13 | PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
14 |
15 | VioSetCurPos(row, col, 0);
16 | }
17 |
18 | void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp)
19 | {
20 | /* this should be enough for the maximum width of a screen. */
21 |
22 | char temp_line[256];
23 | int j;
24 | short fore, back;
25 | unsigned char mapped_attr;
26 | bool blink;
27 |
28 | pair_content(PAIR_NUMBER(attr), &fore, &back);
29 | blink = (SP->termattrs & A_BLINK) && (attr & A_BLINK);
30 |
31 | if (blink)
32 | attr &= ~A_BLINK;
33 |
34 | if (attr & A_BOLD)
35 | fore |= 8;
36 | if (attr & A_BLINK)
37 | back |= 8;
38 |
39 | fore = pdc_curstoreal[fore];
40 | back = pdc_curstoreal[back];
41 |
42 | if (attr & A_REVERSE)
43 | mapped_attr = back | (fore << 4);
44 | else
45 | mapped_attr = fore | (back << 4);
46 |
47 | /* replace the attribute part of the chtype with the
48 | actual color value for each chtype in the line */
49 |
50 | for (j = 0; j < len; j++)
51 | {
52 | chtype ch = srcp[j];
53 |
54 | if (ch & A_ALTCHARSET && !(ch & 0xff80))
55 | ch = acs_map[ch & 0x7f];
56 |
57 | if (blink && blinked_off)
58 | ch = ' ';
59 |
60 | temp_line[j] = ch & 0xff;
61 | }
62 |
63 | VioWrtCharStrAtt((PCH)temp_line, (USHORT)len, (USHORT)lineno,
64 | (USHORT)x, (PBYTE)&mapped_attr, 0);
65 | }
66 |
67 | /* update the given physical line to look like the corresponding line in
68 | curscr */
69 |
70 | void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
71 | {
72 | attr_t old_attr, attr;
73 | int i, j;
74 |
75 | PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno));
76 |
77 | old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET);
78 |
79 | for (i = 1, j = 1; j < len; i++, j++)
80 | {
81 | attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET);
82 |
83 | if (attr != old_attr)
84 | {
85 | _new_packet(old_attr, lineno, x, i, srcp);
86 | old_attr = attr;
87 | srcp += i;
88 | x += i;
89 | i = 0;
90 | }
91 | }
92 |
93 | _new_packet(old_attr, lineno, x, i, srcp);
94 | }
95 |
96 | void PDC_blink_text(void)
97 | {
98 | int i, j, k;
99 |
100 | if (!(SP->termattrs & A_BLINK))
101 | blinked_off = FALSE;
102 | else
103 | blinked_off = !blinked_off;
104 |
105 | for (i = 0; i < SP->lines; i++)
106 | {
107 | const chtype *srcp = curscr->_y[i];
108 |
109 | for (j = 0; j < SP->cols; j++)
110 | if (srcp[j] & A_BLINK)
111 | {
112 | k = j;
113 | while (k < SP->cols && (srcp[k] & A_BLINK))
114 | k++;
115 | PDC_transform_line(i, j, k - j, srcp + j);
116 | j = k;
117 | }
118 | }
119 |
120 | PDC_gotoyx(SP->cursrow, SP->curscol);
121 | pdc_last_blink = PDC_ms_count();
122 | }
123 |
124 | void PDC_doupdate(void)
125 | {
126 | }
127 |
--------------------------------------------------------------------------------
/lib/sdl2/Makefile.vc:
--------------------------------------------------------------------------------
1 | # Visual C++ Makefile for PDCurses - SDL2
2 | #
3 | # Usage: nmake -f [path\]Makefile.vc [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y]
4 | # [INFOEX=N] [target]
5 | #
6 | # where target can be any of:
7 | # [all|demos|pdcurses.lib|testcurs.exe...]
8 |
9 | O = obj
10 | E = .exe
11 | RM = del
12 |
13 | !ifndef PDCURSES_SRCDIR
14 | PDCURSES_SRCDIR = ..
15 | !endif
16 |
17 | osdir = $(PDCURSES_SRCDIR)\sdl2
18 | common = $(PDCURSES_SRCDIR)\common
19 |
20 | !include $(common)\libobjs.mif
21 | !include $(osdir)\versions.mif
22 |
23 | SDL2_INCLUDE = -I$(SDLBASE)\include
24 | SDL2_LIB = $(SDLBASE)\lib\$(PLATFORM)\SDL2.lib
25 | SDL2_LIBMAIN = $(SDLBASE)\lib\$(PLATFORM)\SDL2main.lib
26 |
27 | PDCURSES_WIN_H = $(osdir)\pdcsdl.h
28 |
29 | CC = cl.exe -nologo
30 |
31 | !ifdef DEBUG
32 | CFLAGS = -Z7 -DPDCDEBUG
33 | LDFLAGS = -debug -pdb:none
34 | !else
35 | CFLAGS = -O1
36 | LDFLAGS =
37 | !endif
38 |
39 | !ifdef WIDE
40 | WIDEOPT = -DPDC_WIDE
41 | TTF_INCLUDE = -I$(TTFBASE)\include
42 | TTF_LIB = $(TTFBASE)\lib\$(PLATFORM)\SDL2_ttf.lib
43 | !endif
44 |
45 | !ifdef UTF8
46 | UTF8OPT = -DPDC_FORCE_UTF8
47 | !endif
48 |
49 | !ifdef INFOEX
50 | INFOPT = -DHAVE_NO_INFOEX
51 | !endif
52 |
53 | SHL_LD = link $(LDFLAGS) -nologo -dll -machine:$(PLATFORM) -out:pdcurses.dll
54 |
55 | LINK = link.exe -nologo -subsystem:windows
56 |
57 | LIBEXE = lib -nologo
58 |
59 | LIBCURSES = pdcurses.lib
60 | CURSESDLL = pdcurses.dll
61 |
62 | !ifdef DLL
63 | DLLOPT = -DPDC_DLL_BUILD
64 | PDCLIBS = $(CURSESDLL)
65 | LIBLIBS = $(SDL2_LIB) $(TTF_LIB)
66 | CCLIBS = $(SDL2_LIBMAIN) $(SDL2_LIB)
67 | !else
68 | PDCLIBS = $(LIBCURSES)
69 | CCLIBS = $(SDL2_LIBMAIN) $(SDL2_LIB) $(TTF_LIB)
70 | !endif
71 |
72 | BUILD = $(CC) -I$(PDCURSES_SRCDIR) \
73 | -c $(CFLAGS) $(DLLOPT) $(WIDEOPT) $(UTF8OPT) $(INFOPT)
74 |
75 | all: $(PDCLIBS)
76 |
77 | clean:
78 | -$(RM) *.obj
79 | -$(RM) *.lib
80 | -$(RM) *.exe
81 | -$(RM) *.dll
82 | -$(RM) *.exp
83 | -$(RM) *.res
84 |
85 | demos: $(PDCLIBS) $(DEMOS) sdltest.exe
86 |
87 | DEMOOBJS = $(DEMOS:.exe=.obj) tui.obj sdltest.obj
88 |
89 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
90 | $(PDCOBJS) : $(PDCURSES_WIN_H)
91 | $(DEMOOBJS) : $(PDCURSES_CURSES_H)
92 | $(DEMOS) : $(LIBCURSES)
93 | panel.obj : $(PANEL_HEADER)
94 |
95 | !ifndef DLL
96 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
97 | $(LIBEXE) -out:$@ $(LIBOBJS) $(PDCOBJS)
98 | !endif
99 |
100 | $(CURSESDLL) : $(LIBOBJS) $(PDCOBJS) pdcurses.obj
101 | $(SHL_LD) $(LIBOBJS) $(PDCOBJS) pdcurses.obj $(LIBLIBS)
102 |
103 | pdcurses.res pdcurses.obj: $(common)\pdcurses.rc
104 | rc -r -fopdcurses.res $(common)\pdcurses.rc
105 | cvtres -machine:$(PLATFORM) -nologo -out:pdcurses.obj pdcurses.res
106 |
107 | {$(srcdir)\}.c{}.obj::
108 | $(BUILD) $<
109 |
110 | {$(osdir)\}.c{}.obj::
111 | $(BUILD) -Dmain=SDL_main $(SDL2_INCLUDE) $(TTF_INCLUDE) $<
112 |
113 | {$(demodir)\}.c{}.obj::
114 | $(BUILD) -Dmain=SDL_main $<
115 |
116 | .obj.exe:
117 | $(LINK) $(LDFLAGS) $< $(LIBCURSES) $(CCLIBS)
118 |
119 | tuidemo.exe: tuidemo.obj tui.obj
120 | $(LINK) $(LDFLAGS) $*.obj tui.obj $(LIBCURSES) $(CCLIBS)
121 |
122 | tui.obj: $(demodir)\tui.c $(demodir)\tui.h
123 | $(BUILD) -I$(demodir) $(demodir)\tui.c
124 |
125 | tuidemo.obj: $(demodir)\tuidemo.c
126 | $(BUILD) -Dmain=SDL_main -I$(demodir) $(demodir)\tuidemo.c
127 |
128 | sdltest.exe: sdltest.obj
129 | $(LINK) $(LDFLAGS) $*.obj $(LIBCURSES) $(LIBLIBS) $(CCLIBS)
130 |
--------------------------------------------------------------------------------
/lib/pdcurses/inch.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | inch
8 | ----
9 |
10 | ### Synopsis
11 |
12 | chtype inch(void);
13 | chtype winch(WINDOW *win);
14 | chtype mvinch(int y, int x);
15 | chtype mvwinch(WINDOW *win, int y, int x);
16 |
17 | int in_wch(cchar_t *wcval);
18 | int win_wch(WINDOW *win, cchar_t *wcval);
19 | int mvin_wch(int y, int x, cchar_t *wcval);
20 | int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval);
21 |
22 | ### Description
23 |
24 | The inch() functions retrieve the character and attribute from the
25 | current or specified window position, in the form of a chtype. If a
26 | NULL window is specified, (chtype)ERR is returned.
27 |
28 | The in_wch() functions are the wide-character versions; instead of
29 | returning a chtype, they store a cchar_t at the address specified by
30 | wcval, and return OK or ERR. (No value is stored when ERR is
31 | returned.) Note that in PDCurses, chtype and cchar_t are the same.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | inch Y Y Y
36 | winch Y Y Y
37 | mvinch Y Y Y
38 | mvwinch Y Y Y
39 | in_wch Y Y Y
40 | win_wch Y Y Y
41 | mvin_wch Y Y Y
42 | mvwin_wch Y Y Y
43 |
44 | **man-end****************************************************************/
45 |
46 | chtype winch(WINDOW *win)
47 | {
48 | PDC_LOG(("winch() - called\n"));
49 |
50 | if (!win)
51 | return (chtype)ERR;
52 |
53 | return win->_y[win->_cury][win->_curx];
54 | }
55 |
56 | chtype inch(void)
57 | {
58 | PDC_LOG(("inch() - called\n"));
59 |
60 | return winch(stdscr);
61 | }
62 |
63 | chtype mvinch(int y, int x)
64 | {
65 | PDC_LOG(("mvinch() - called\n"));
66 |
67 | if (move(y, x) == ERR)
68 | return (chtype)ERR;
69 |
70 | return stdscr->_y[stdscr->_cury][stdscr->_curx];
71 | }
72 |
73 | chtype mvwinch(WINDOW *win, int y, int x)
74 | {
75 | PDC_LOG(("mvwinch() - called\n"));
76 |
77 | if (wmove(win, y, x) == ERR)
78 | return (chtype)ERR;
79 |
80 | return win->_y[win->_cury][win->_curx];
81 | }
82 |
83 | #ifdef PDC_WIDE
84 | int win_wch(WINDOW *win, cchar_t *wcval)
85 | {
86 | PDC_LOG(("win_wch() - called\n"));
87 |
88 | if (!win || !wcval)
89 | return ERR;
90 |
91 | *wcval = win->_y[win->_cury][win->_curx];
92 |
93 | return OK;
94 | }
95 |
96 | int in_wch(cchar_t *wcval)
97 | {
98 | PDC_LOG(("in_wch() - called\n"));
99 |
100 | return win_wch(stdscr, wcval);
101 | }
102 |
103 | int mvin_wch(int y, int x, cchar_t *wcval)
104 | {
105 | PDC_LOG(("mvin_wch() - called\n"));
106 |
107 | if (!wcval || (move(y, x) == ERR))
108 | return ERR;
109 |
110 | *wcval = stdscr->_y[stdscr->_cury][stdscr->_curx];
111 |
112 | return OK;
113 | }
114 |
115 | int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval)
116 | {
117 | PDC_LOG(("mvwin_wch() - called\n"));
118 |
119 | if (!wcval || (wmove(win, y, x) == ERR))
120 | return ERR;
121 |
122 | *wcval = win->_y[win->_cury][win->_curx];
123 |
124 | return OK;
125 | }
126 | #endif
127 |
--------------------------------------------------------------------------------
/lib/dos/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcdos.h"
4 |
5 | /*man-start**************************************************************
6 |
7 | pdcsetsc
8 | --------
9 |
10 | ### Synopsis
11 |
12 | int PDC_set_blink(bool blinkon);
13 | int PDC_set_bold(bool boldon);
14 | void PDC_set_title(const char *title);
15 |
16 | ### Description
17 |
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
19 | blink mode (TRUE), or sets the background color to high intensity
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It
21 | returns OK if it could set the state to match the given parameter,
22 | ERR otherwise. On DOS, this function also adjusts the value of COLORS
23 | -- 16 for FALSE, and 8 for TRUE.
24 |
25 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
26 | bold font (TRUE), or sets the foreground color to high intensity
27 | (FALSE). It returns OK if it could set the state to match the given
28 | parameter, ERR otherwise.
29 |
30 | PDC_set_title() sets the title of the window in which the curses
31 | program is running. This function may not do anything on some
32 | platforms.
33 |
34 | ### Portability
35 | X/Open ncurses NetBSD
36 | PDC_set_blink - - -
37 | PDC_set_title - - -
38 |
39 | **man-end****************************************************************/
40 |
41 | int PDC_curs_set(int visibility)
42 | {
43 | PDCREGS regs;
44 | int ret_vis, start, end;
45 |
46 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
47 |
48 | ret_vis = SP->visibility;
49 | SP->visibility = visibility;
50 |
51 | switch (visibility)
52 | {
53 | case 0: /* invisible */
54 | start = 32;
55 | end = 0; /* was 32 */
56 | break;
57 | case 2: /* highly visible */
58 | start = 0; /* full-height block */
59 | end = 7;
60 | break;
61 | default: /* normal visibility */
62 | start = (SP->orig_cursor >> 8) & 0xff;
63 | end = SP->orig_cursor & 0xff;
64 | }
65 |
66 | /* if scrnmode is not set, some BIOSes hang */
67 |
68 | regs.h.ah = 0x01;
69 | regs.h.al = (unsigned char)pdc_scrnmode;
70 | regs.h.ch = (unsigned char)start;
71 | regs.h.cl = (unsigned char)end;
72 | PDCINT(0x10, regs);
73 |
74 | return ret_vis;
75 | }
76 |
77 | void PDC_set_title(const char *title)
78 | {
79 | PDC_LOG(("PDC_set_title() - called: <%s>\n", title));
80 | }
81 |
82 | int PDC_set_blink(bool blinkon)
83 | {
84 | PDCREGS regs;
85 |
86 | if (!SP)
87 | return ERR;
88 |
89 | switch (pdc_adapter)
90 | {
91 | case _EGACOLOR:
92 | case _EGAMONO:
93 | case _VGACOLOR:
94 | case _VGAMONO:
95 | regs.W.ax = 0x1003;
96 | regs.W.bx = blinkon;
97 |
98 | PDCINT(0x10, regs);
99 |
100 | if (SP->color_started)
101 | COLORS = blinkon ? 8 : 16;
102 |
103 | break;
104 | default:
105 | COLORS = 8;
106 | }
107 |
108 | if (blinkon && (COLORS == 8))
109 | SP->termattrs |= A_BLINK;
110 | else if (!blinkon && (COLORS == 16))
111 | SP->termattrs &= ~A_BLINK;
112 |
113 | return (COLORS - (blinkon * 8) != 8) ? OK : ERR;
114 | }
115 |
116 | int PDC_set_bold(bool boldon)
117 | {
118 | return boldon ? ERR : OK;
119 | }
120 |
--------------------------------------------------------------------------------
/lib/pdcurses/printw.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | printw
8 | ------
9 |
10 | ### Synopsis
11 |
12 | int printw(const char *fmt, ...);
13 | int wprintw(WINDOW *win, const char *fmt, ...);
14 | int mvprintw(int y, int x, const char *fmt, ...);
15 | int mvwprintw(WINDOW *win, int y, int x, const char *fmt,...);
16 | int vwprintw(WINDOW *win, const char *fmt, va_list varglist);
17 | int vw_printw(WINDOW *win, const char *fmt, va_list varglist);
18 |
19 | ### Description
20 |
21 | The printw() functions add a formatted string to the window at the
22 | current or specified cursor position. The format strings are the same
23 | as used in the standard C library's printf(). (printw() can be used
24 | as a drop-in replacement for printf().)
25 |
26 | The duplication between vwprintw() and vw_printw() is for historic
27 | reasons. In PDCurses, they're the same.
28 |
29 | ### Return Value
30 |
31 | All functions return the number of characters printed, or ERR on
32 | error.
33 |
34 | ### Portability
35 | X/Open ncurses NetBSD
36 | printw Y Y Y
37 | wprintw Y Y Y
38 | mvprintw Y Y Y
39 | mvwprintw Y Y Y
40 | vwprintw Y Y Y
41 | vw_printw Y Y Y
42 |
43 | **man-end****************************************************************/
44 |
45 | #include
46 |
47 | int vwprintw(WINDOW *win, const char *fmt, va_list varglist)
48 | {
49 | char printbuf[513];
50 | int len;
51 |
52 | PDC_LOG(("vwprintw() - called\n"));
53 |
54 | #ifdef HAVE_VSNPRINTF
55 | len = vsnprintf(printbuf, 512, fmt, varglist);
56 | #else
57 | len = vsprintf(printbuf, fmt, varglist);
58 | #endif
59 | return (waddstr(win, printbuf) == ERR) ? ERR : len;
60 | }
61 |
62 | int printw(const char *fmt, ...)
63 | {
64 | va_list args;
65 | int retval;
66 |
67 | PDC_LOG(("printw() - called\n"));
68 |
69 | va_start(args, fmt);
70 | retval = vwprintw(stdscr, fmt, args);
71 | va_end(args);
72 |
73 | return retval;
74 | }
75 |
76 | int wprintw(WINDOW *win, const char *fmt, ...)
77 | {
78 | va_list args;
79 | int retval;
80 |
81 | PDC_LOG(("wprintw() - called\n"));
82 |
83 | va_start(args, fmt);
84 | retval = vwprintw(win, fmt, args);
85 | va_end(args);
86 |
87 | return retval;
88 | }
89 |
90 | int mvprintw(int y, int x, const char *fmt, ...)
91 | {
92 | va_list args;
93 | int retval;
94 |
95 | PDC_LOG(("mvprintw() - called\n"));
96 |
97 | if (move(y, x) == ERR)
98 | return ERR;
99 |
100 | va_start(args, fmt);
101 | retval = vwprintw(stdscr, fmt, args);
102 | va_end(args);
103 |
104 | return retval;
105 | }
106 |
107 | int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
108 | {
109 | va_list args;
110 | int retval;
111 |
112 | PDC_LOG(("mvwprintw() - called\n"));
113 |
114 | if (wmove(win, y, x) == ERR)
115 | return ERR;
116 |
117 | va_start(args, fmt);
118 | retval = vwprintw(win, fmt, args);
119 | va_end(args);
120 |
121 | return retval;
122 | }
123 |
124 | int vw_printw(WINDOW *win, const char *fmt, va_list varglist)
125 | {
126 | PDC_LOG(("vw_printw() - called\n"));
127 |
128 | return vwprintw(win, fmt, varglist);
129 | }
130 |
--------------------------------------------------------------------------------
/lib/sdl2/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for PDCurses for SDL2
2 |
3 | O = o
4 |
5 | ifndef PDCURSES_SRCDIR
6 | PDCURSES_SRCDIR = ..
7 | endif
8 |
9 | osdir = $(PDCURSES_SRCDIR)/sdl2
10 | common = $(PDCURSES_SRCDIR)/common
11 |
12 | include $(common)/libobjs.mif
13 |
14 | ifeq ($(OS),Windows_NT)
15 | E = .exe
16 | CC = gcc
17 | RM = cmd /c del
18 |
19 | include $(osdir)/versions.mif
20 |
21 | PLATFORM = $(shell $(CC) -dumpmachine)
22 |
23 | SFLAGS = -I$(SDLBASE)/$(PLATFORM)/include/SDL2
24 | SLIBS = -L$(SDLBASE)/$(PLATFORM)/lib -lSDL2main -lSDL2
25 |
26 | TFLAGS = -I$(TTFBASE)/$(PLATFORM)/include/SDL2
27 | TLIBS =-L$(TTFBASE)/$(PLATFORM)/lib -lSDL2_ttf
28 |
29 | DEMOFLAGS = -mwindows
30 | else
31 | RM = rm -f
32 |
33 | SFLAGS = $(shell sdl2-config --cflags)
34 | SLIBS = $(shell sdl2-config --libs)
35 |
36 | TLIBS = -lSDL2_ttf
37 | endif
38 |
39 | PDCURSES_SDL_H = $(osdir)/pdcsdl.h
40 |
41 | ifeq ($(DEBUG),Y)
42 | CFLAGS = -g -Wall -DPDCDEBUG -fPIC
43 | else
44 | CFLAGS += -O2 -Wall -fPIC
45 | endif
46 |
47 | ifeq ($(WIDE),Y)
48 | CFLAGS += -DPDC_WIDE
49 | SFLAGS += $(TFLAGS)
50 | SLIBS += $(TLIBS)
51 | endif
52 |
53 | ifeq ($(UTF8),Y)
54 | CFLAGS += -DPDC_FORCE_UTF8
55 | endif
56 |
57 | ifeq ($(OS)_$(DLL),Windows_NT_Y)
58 | CFLAGS += -DPDC_DLL_BUILD
59 | LIBEXE = $(CC)
60 | LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o
61 | LIBCURSES = pdcurses.dll
62 | CLEAN = $(LIBCURSES) *.a
63 | RESOURCE = pdcurses.o
64 | LIBLIBS = $(SLIBS)
65 | LDFLAGS = $(LIBCURSES)
66 | else
67 | LIBEXE = $(AR)
68 | LIBFLAGS = rcv
69 | LIBCURSES = pdcurses.a
70 | LDFLAGS = $(LIBCURSES) $(SLIBS)
71 | CLEAN = *.a
72 | endif
73 |
74 | BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR)
75 |
76 | LINK = $(CC)
77 |
78 | DEMOS += sdltest$(E)
79 |
80 | .PHONY: all libs clean demos
81 |
82 | all: libs
83 |
84 | libs: $(LIBCURSES)
85 |
86 | clean:
87 | -$(RM) *.o trace $(CLEAN) $(DEMOS)
88 |
89 | demos: $(DEMOS)
90 | ifneq ($(DEBUG),Y)
91 | strip $(DEMOS)
92 | endif
93 |
94 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(RESOURCE)
95 | $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBLIBS)
96 |
97 | pdcurses.o: $(common)/pdcurses.rc
98 | windres -i $(common)/pdcurses.rc pdcurses.o
99 |
100 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
101 | $(PDCOBJS) : $(PDCURSES_SDL_H)
102 | $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES)
103 | tui.o tuidemo.o : $(PDCURSES_CURSES_H)
104 | panel.o ptest$(E): $(PANEL_HEADER)
105 |
106 | $(LIBOBJS) : %.o: $(srcdir)/%.c
107 | $(BUILD) -c $<
108 |
109 | $(PDCOBJS) : %.o: $(osdir)/%.c
110 | $(BUILD) $(SFLAGS) -c $<
111 |
112 | firework$(E): $(demodir)/firework.c
113 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
114 |
115 | ozdemo$(E): $(demodir)/ozdemo.c
116 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
117 |
118 | ptest$(E): $(demodir)/ptest.c
119 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
120 |
121 | rain$(E): $(demodir)/rain.c
122 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
123 |
124 | testcurs$(E): $(demodir)/testcurs.c
125 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
126 |
127 | tuidemo$(E): tuidemo.o tui.o
128 | $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS)
129 |
130 | worm$(E): $(demodir)/worm.c
131 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
132 |
133 | xmas$(E): $(demodir)/xmas.c
134 | $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS)
135 |
136 | sdltest$(E): $(osdir)/sdltest.c
137 | $(BUILD) $(SFLAGS) $(DEMOFLAGS) -o $@ $< $(LIBCURSES) $(SLIBS)
138 |
139 | tui.o: $(demodir)/tui.c $(demodir)/tui.h
140 | $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c
141 |
142 | tuidemo.o: $(demodir)/tuidemo.c
143 | $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c
144 |
145 | include $(demodir)/nctests.mif
146 |
--------------------------------------------------------------------------------
/lib/wincon/pdcsetsc.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcwin.h"
4 |
5 | /*man-start**************************************************************
6 |
7 | pdcsetsc
8 | --------
9 |
10 | ### Synopsis
11 |
12 | int PDC_set_blink(bool blinkon);
13 | int PDC_set_bold(bool boldon);
14 | void PDC_set_title(const char *title);
15 |
16 | ### Description
17 |
18 | PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
19 | blink mode (TRUE), or sets the background color to high intensity
20 | (FALSE). The default is platform-dependent (FALSE in most cases). It
21 | returns OK if it could set the state to match the given parameter,
22 | ERR otherwise.
23 |
24 | PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
25 | bold font (TRUE), or sets the foreground color to high intensity
26 | (FALSE). It returns OK if it could set the state to match the given
27 | parameter, ERR otherwise.
28 |
29 | PDC_set_title() sets the title of the window in which the curses
30 | program is running. This function may not do anything on some
31 | platforms.
32 |
33 | ### Portability
34 | X/Open ncurses NetBSD
35 | PDC_set_blink - - -
36 | PDC_set_title - - -
37 |
38 | **man-end****************************************************************/
39 |
40 | int PDC_curs_set(int visibility)
41 | {
42 | CONSOLE_CURSOR_INFO cci;
43 | int ret_vis;
44 |
45 | PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
46 |
47 | ret_vis = SP->visibility;
48 |
49 | if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
50 | return ERR;
51 |
52 | switch(visibility)
53 | {
54 | case 0: /* invisible */
55 | cci.bVisible = FALSE;
56 | break;
57 | case 2: /* highly visible */
58 | cci.bVisible = TRUE;
59 | cci.dwSize = 95;
60 | break;
61 | default: /* normal visibility */
62 | cci.bVisible = TRUE;
63 | cci.dwSize = SP->orig_cursor;
64 | break;
65 | }
66 |
67 | if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
68 | return ERR;
69 |
70 | SP->visibility = visibility;
71 | return ret_vis;
72 | }
73 |
74 | void PDC_set_title(const char *title)
75 | {
76 | #ifdef PDC_WIDE
77 | wchar_t wtitle[512];
78 | #endif
79 | PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
80 |
81 | #ifdef PDC_WIDE
82 | PDC_mbstowcs(wtitle, title, 511);
83 | SetConsoleTitleW(wtitle);
84 | #else
85 | SetConsoleTitleA(title);
86 | #endif
87 | }
88 |
89 | int PDC_set_blink(bool blinkon)
90 | {
91 | if (!SP)
92 | return ERR;
93 |
94 | if (SP->color_started)
95 | {
96 | COLORS = 16;
97 | if (PDC_can_change_color()) /* is_nt */
98 | {
99 | if (pdc_conemu || SetConsoleMode(pdc_con_out, 0x0004)) /* VT */
100 | COLORS = PDC_MAXCOL;
101 |
102 | if (!pdc_conemu)
103 | SetConsoleMode(pdc_con_out, 0x0010); /* LVB */
104 | }
105 | }
106 |
107 | if (blinkon)
108 | {
109 | if (!(SP->termattrs & A_BLINK))
110 | {
111 | SP->termattrs |= A_BLINK;
112 | pdc_last_blink = GetTickCount();
113 | }
114 | }
115 | else
116 | {
117 | if (SP->termattrs & A_BLINK)
118 | {
119 | SP->termattrs &= ~A_BLINK;
120 | PDC_blink_text();
121 | }
122 | }
123 |
124 | return OK;
125 | }
126 |
127 | int PDC_set_bold(bool boldon)
128 | {
129 | return boldon ? ERR : OK;
130 | }
131 |
--------------------------------------------------------------------------------
/lib/demos/firework.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #define DELAYSIZE 200
6 |
7 | void myrefresh(void);
8 | void get_color(void);
9 | void explode(int, int);
10 |
11 | short color_table[] =
12 | {
13 | COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
14 | COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE
15 | };
16 |
17 | int main(int argc, char **argv)
18 | {
19 | time_t seed;
20 | int start, end, row, diff, flag, direction;
21 | short i;
22 |
23 | #ifdef XCURSES
24 | Xinitscr(argc, argv);
25 | #else
26 | initscr();
27 | #endif
28 | keypad(stdscr, TRUE);
29 | nodelay(stdscr, TRUE);
30 | noecho();
31 |
32 | if (has_colors())
33 | start_color();
34 |
35 | for (i = 0; i < 8; i++)
36 | init_pair(i, color_table[i], COLOR_BLACK);
37 |
38 | seed = time((time_t *)0);
39 | srand(seed);
40 | flag = 0;
41 |
42 | while (getch() == ERR) /* loop until a key is hit */
43 | {
44 | do {
45 | start = rand() % (COLS - 3);
46 | end = rand() % (COLS - 3);
47 | start = (start < 2) ? 2 : start;
48 | end = (end < 2) ? 2 : end;
49 | direction = (start > end) ? -1 : 1;
50 | diff = abs(start - end);
51 |
52 | } while (diff < 2 || diff >= LINES - 2);
53 |
54 | attrset(A_NORMAL);
55 |
56 | for (row = 0; row < diff; row++)
57 | {
58 | mvaddstr(LINES - row, row * direction + start,
59 | (direction < 0) ? "\\" : "/");
60 |
61 | if (flag++)
62 | {
63 | myrefresh();
64 | erase();
65 | flag = 0;
66 | }
67 | }
68 |
69 | if (flag++)
70 | {
71 | myrefresh();
72 | flag = 0;
73 | }
74 |
75 | explode(LINES - row, diff * direction + start);
76 | erase();
77 | myrefresh();
78 | }
79 |
80 | endwin();
81 |
82 | return 0;
83 | }
84 |
85 | void explode(int row, int col)
86 | {
87 | erase();
88 | mvaddstr(row, col, "-");
89 | myrefresh();
90 |
91 | --col;
92 |
93 | get_color();
94 | mvaddstr(row - 1, col, " - ");
95 | mvaddstr(row, col, "-+-");
96 | mvaddstr(row + 1, col, " - ");
97 | myrefresh();
98 |
99 | --col;
100 |
101 | get_color();
102 | mvaddstr(row - 2, col, " --- ");
103 | mvaddstr(row - 1, col, "-+++-");
104 | mvaddstr(row, col, "-+#+-");
105 | mvaddstr(row + 1, col, "-+++-");
106 | mvaddstr(row + 2, col, " --- ");
107 | myrefresh();
108 |
109 | get_color();
110 | mvaddstr(row - 2, col, " +++ ");
111 | mvaddstr(row - 1, col, "++#++");
112 | mvaddstr(row, col, "+# #+");
113 | mvaddstr(row + 1, col, "++#++");
114 | mvaddstr(row + 2, col, " +++ ");
115 | myrefresh();
116 |
117 | get_color();
118 | mvaddstr(row - 2, col, " # ");
119 | mvaddstr(row - 1, col, "## ##");
120 | mvaddstr(row, col, "# #");
121 | mvaddstr(row + 1, col, "## ##");
122 | mvaddstr(row + 2, col, " # ");
123 | myrefresh();
124 |
125 | get_color();
126 | mvaddstr(row - 2, col, " # # ");
127 | mvaddstr(row - 1, col, "# #");
128 | mvaddstr(row, col, " ");
129 | mvaddstr(row + 1, col, "# #");
130 | mvaddstr(row + 2, col, " # # ");
131 | myrefresh();
132 | }
133 |
134 | void myrefresh(void)
135 | {
136 | napms(DELAYSIZE);
137 | move(LINES - 1, COLS - 1);
138 | refresh();
139 | }
140 |
141 | void get_color(void)
142 | {
143 | chtype bold = (rand() % 2) ? A_BOLD : A_NORMAL;
144 | attrset(COLOR_PAIR(rand() % 8) | bold);
145 | }
146 |
--------------------------------------------------------------------------------
/haxe/ui/backend/TextDisplayImpl.hx:
--------------------------------------------------------------------------------
1 | package haxe.ui.backend;
2 | import haxe.ui.backend.pdcurses.Window;
3 | import haxe.ui.components.Button;
4 | import haxe.ui.geom.Rectangle;
5 |
6 | class TextDisplayImpl extends TextBase {
7 | private var _color:Int;
8 | private var _textAlign:String;
9 |
10 | private override function validateData() {
11 | #if haxeui_pdcurses_uppercase_strings
12 | _text = _text.toUpperCase();
13 | #end
14 | }
15 |
16 | private override function validateStyle():Bool {
17 | if (_textStyle != null) {
18 | if (_textAlign != _textStyle.textAlign) {
19 | _textAlign = _textStyle.textAlign;
20 | }
21 | if (_color != _textStyle.color) {
22 | _color = _textStyle.color;
23 | }
24 | }
25 | return true;
26 | }
27 |
28 | public function print(window:Window, x:Int, y:Int) {
29 | if (_lines != null) {
30 | var ty:Int = Std.int(y + _top);
31 | for (line in _lines) {
32 | var tx:Int = x;
33 | var lx:Int = line.length;
34 |
35 | switch(_textAlign) {
36 | case "center":
37 | tx += Std.int((_width - lx) / 2);
38 |
39 | case "right":
40 | tx += Std.int(_width - lx);
41 |
42 | default:
43 | tx += Std.int(_left);
44 | }
45 |
46 | window.drawString(line, tx, ty, -1, -1, _color);
47 | ty += 1;
48 | }
49 | }
50 | }
51 |
52 |
53 | private var _lines:Array;
54 | private override function measureText() {
55 | if (_text == null || _text.length == 0 ) {
56 | _textWidth = 0;
57 | _textHeight = 0;
58 | return;
59 | }
60 |
61 | if (_width <= 0) {
62 | _lines = new Array();
63 | _lines.push(_text);
64 | _textWidth = _text.length;
65 | _textHeight = 1;
66 | return;
67 | }
68 |
69 |
70 | var maxWidth:Float = _width;
71 | _lines = new Array();
72 | _text = normalizeText(_text);
73 | var lines = _text.split("\n");
74 | var biggestWidth:Float = 0;
75 | for (line in lines) {
76 | var tw = line.length;
77 | if (tw > maxWidth) {
78 | var words = Lambda.list(line.split(" "));
79 | while (!words.isEmpty()) {
80 | line = words.pop();
81 | tw = line.length;
82 | biggestWidth = Math.max(biggestWidth, tw);
83 | var nextWord = words.pop();
84 | while (nextWord != null && (tw = (line + " " + nextWord).length) <= maxWidth) {
85 | biggestWidth = Math.max(biggestWidth, tw);
86 | line += " " + nextWord;
87 | nextWord = words.pop();
88 | }
89 | _lines.push(line);
90 | if (nextWord != null) {
91 | words.push(nextWord);
92 | }
93 | }
94 | } else {
95 | biggestWidth = Math.max(biggestWidth, tw);
96 | //if (line != '') {
97 | _lines.push(line);
98 | //}
99 | }
100 | }
101 |
102 | _textWidth = biggestWidth;
103 | _textHeight = _lines.length;
104 | }
105 |
106 | private function normalizeText(text:String):String {
107 | text = StringTools.replace(text, "\\n", "\n");
108 | return text;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/lib/pdcurses/clear.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | clear
8 | -----
9 |
10 | ### Synopsis
11 |
12 | int clear(void);
13 | int wclear(WINDOW *win);
14 | int erase(void);
15 | int werase(WINDOW *win);
16 | int clrtobot(void);
17 | int wclrtobot(WINDOW *win);
18 | int clrtoeol(void);
19 | int wclrtoeol(WINDOW *win);
20 |
21 | ### Description
22 |
23 | erase() and werase() copy blanks (i.e. the background chtype) to
24 | every cell of the window.
25 |
26 | clear() and wclear() are similar to erase() and werase(), but they
27 | also call clearok() to ensure that the the window is cleared on the
28 | next wrefresh().
29 |
30 | clrtobot() and wclrtobot() clear the window from the current cursor
31 | position to the end of the window.
32 |
33 | clrtoeol() and wclrtoeol() clear the window from the current cursor
34 | position to the end of the current line.
35 |
36 | ### Return Value
37 |
38 | All functions return OK on success and ERR on error.
39 |
40 | ### Portability
41 | X/Open ncurses NetBSD
42 | clear Y Y Y
43 | wclear Y Y Y
44 | erase Y Y Y
45 | werase Y Y Y
46 | clrtobot Y Y Y
47 | wclrtobot Y Y Y
48 | clrtoeol Y Y Y
49 | wclrtoeol Y Y Y
50 |
51 | **man-end****************************************************************/
52 |
53 | int wclrtoeol(WINDOW *win)
54 | {
55 | int x, y, minx;
56 | chtype blank, *ptr;
57 |
58 | PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n",
59 | win->_cury, win->_curx));
60 |
61 | if (!win)
62 | return ERR;
63 |
64 | y = win->_cury;
65 | x = win->_curx;
66 |
67 | /* wrs (4/10/93) account for window background */
68 |
69 | blank = win->_bkgd;
70 |
71 | for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++)
72 | *ptr = blank;
73 |
74 | if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE)
75 | win->_firstch[y] = x;
76 |
77 | win->_lastch[y] = win->_maxx - 1;
78 |
79 | PDC_sync(win);
80 | return OK;
81 | }
82 |
83 | int clrtoeol(void)
84 | {
85 | PDC_LOG(("clrtoeol() - called\n"));
86 |
87 | return wclrtoeol(stdscr);
88 | }
89 |
90 | int wclrtobot(WINDOW *win)
91 | {
92 | int savey, savex;
93 |
94 | PDC_LOG(("wclrtobot() - called\n"));
95 |
96 | if (!win)
97 | return ERR;
98 |
99 | savey = win->_cury;
100 | savex = win->_curx;
101 |
102 | /* should this involve scrolling region somehow ? */
103 |
104 | if (win->_cury + 1 < win->_maxy)
105 | {
106 | win->_curx = 0;
107 | win->_cury++;
108 | for (; win->_maxy > win->_cury; win->_cury++)
109 | wclrtoeol(win);
110 | win->_cury = savey;
111 | win->_curx = savex;
112 | }
113 | wclrtoeol(win);
114 |
115 | PDC_sync(win);
116 | return OK;
117 | }
118 |
119 | int clrtobot(void)
120 | {
121 | PDC_LOG(("clrtobot() - called\n"));
122 |
123 | return wclrtobot(stdscr);
124 | }
125 |
126 | int werase(WINDOW *win)
127 | {
128 | PDC_LOG(("werase() - called\n"));
129 |
130 | if (wmove(win, 0, 0) == ERR)
131 | return ERR;
132 |
133 | return wclrtobot(win);
134 | }
135 |
136 | int erase(void)
137 | {
138 | PDC_LOG(("erase() - called\n"));
139 |
140 | return werase(stdscr);
141 | }
142 |
143 | int wclear(WINDOW *win)
144 | {
145 | PDC_LOG(("wclear() - called\n"));
146 |
147 | if (!win)
148 | return ERR;
149 |
150 | win->_clear = TRUE;
151 | return werase(win);
152 | }
153 |
154 | int clear(void)
155 | {
156 | PDC_LOG(("clear() - called\n"));
157 |
158 | return wclear(stdscr);
159 | }
160 |
--------------------------------------------------------------------------------
/lib/curspriv.h:
--------------------------------------------------------------------------------
1 | /* Private definitions and declarations for use within PDCurses.
2 | These should generally not be referenced by applications. */
3 |
4 | #ifndef __CURSES_INTERNALS__
5 | #define __CURSES_INTERNALS__ 1
6 |
7 | #define CURSES_LIBRARY
8 | #include
9 |
10 | #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \
11 | defined(PDC_99) || defined(__WATCOMC__)
12 | # ifndef HAVE_VSSCANF
13 | # define HAVE_VSSCANF /* have vsscanf() */
14 | # endif
15 | #endif
16 |
17 | #if defined(PDC_99) || defined(__WATCOMC__)
18 | # ifndef HAVE_VSNPRINTF
19 | # define HAVE_VSNPRINTF /* have vsnprintf() */
20 | # endif
21 | #endif
22 |
23 | /*----------------------------------------------------------------------*/
24 |
25 | typedef struct /* structure for ripped off lines */
26 | {
27 | int line;
28 | int (*init)(WINDOW *, int);
29 | } RIPPEDOFFLINE;
30 |
31 | /* Window properties */
32 |
33 | #define _SUBWIN 0x01 /* window is a subwindow */
34 | #define _PAD 0x10 /* X/Open Pad. */
35 | #define _SUBPAD 0x20 /* X/Open subpad. */
36 |
37 | /* Miscellaneous */
38 |
39 | #define _NO_CHANGE -1 /* flags line edge unchanged */
40 |
41 | #define _ECHAR 0x08 /* Erase char (^H) */
42 | #define _DWCHAR 0x17 /* Delete Word char (^W) */
43 | #define _DLCHAR 0x15 /* Delete Line char (^U) */
44 |
45 | /*----------------------------------------------------------------------*/
46 |
47 | /* Platform implementation functions */
48 |
49 | void PDC_beep(void);
50 | bool PDC_can_change_color(void);
51 | int PDC_color_content(short, short *, short *, short *);
52 | bool PDC_check_key(void);
53 | int PDC_curs_set(int);
54 | void PDC_doupdate(void);
55 | void PDC_flushinp(void);
56 | int PDC_get_columns(void);
57 | int PDC_get_cursor_mode(void);
58 | int PDC_get_key(void);
59 | int PDC_get_rows(void);
60 | void PDC_gotoyx(int, int);
61 | bool PDC_has_mouse(void);
62 | int PDC_init_color(short, short, short, short);
63 | int PDC_modifiers_set(void);
64 | int PDC_mouse_set(void);
65 | void PDC_napms(int);
66 | void PDC_reset_prog_mode(void);
67 | void PDC_reset_shell_mode(void);
68 | int PDC_resize_screen(int, int);
69 | void PDC_restore_screen_mode(int);
70 | void PDC_save_screen_mode(int);
71 | #ifdef XCURSES
72 | void PDC_set_args(int, char **);
73 | #endif
74 | void PDC_scr_close(void);
75 | void PDC_scr_free(void);
76 | int PDC_scr_open(void);
77 | void PDC_set_keyboard_binary(bool);
78 | void PDC_transform_line(int, int, int, const chtype *);
79 | const char *PDC_sysname(void);
80 |
81 | /* Internal cross-module functions */
82 |
83 | void PDC_init_atrtab(void);
84 | WINDOW *PDC_makelines(WINDOW *);
85 | WINDOW *PDC_makenew(int, int, int, int);
86 | int PDC_mouse_in_slk(int, int);
87 | void PDC_slk_free(void);
88 | void PDC_slk_initialize(void);
89 | void PDC_sync(WINDOW *);
90 |
91 | #ifdef PDC_WIDE
92 | int PDC_mbtowc(wchar_t *, const char *, size_t);
93 | size_t PDC_mbstowcs(wchar_t *, const char *, size_t);
94 | size_t PDC_wcstombs(char *, const wchar_t *, size_t);
95 | #endif
96 |
97 | #ifdef PDCDEBUG
98 | # define PDC_LOG(x) if (SP && SP->dbfp) PDC_debug x
99 | #else
100 | # define PDC_LOG(x)
101 | #endif
102 |
103 | /* Internal macros for attributes */
104 |
105 | #ifndef max
106 | # define max(a,b) (((a) > (b)) ? (a) : (b))
107 | #endif
108 | #ifndef min
109 | # define min(a,b) (((a) < (b)) ? (a) : (b))
110 | #endif
111 |
112 | #define DIVROUND(num, divisor) ((num) + ((divisor) >> 1)) / (divisor)
113 |
114 | #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if
115 | not set by mouseinterval() */
116 | #define PDC_COLOR_PAIRS 256
117 | #define PDC_MAXCOL 768 /* maximum possible COLORS; may be less */
118 |
119 | #define _INBUFSIZ 512 /* size of terminal input buffer */
120 | #define NUNGETCH 256 /* max # chars to ungetch() */
121 |
122 | #endif /* __CURSES_INTERNALS__ */
123 |
--------------------------------------------------------------------------------
/lib/sdl1/pdcclip.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcsdl.h"
4 |
5 | #include
6 | #include
7 |
8 | /*man-start**************************************************************
9 |
10 | clipboard
11 | ---------
12 |
13 | ### Synopsis
14 |
15 | int PDC_getclipboard(char **contents, long *length);
16 | int PDC_setclipboard(const char *contents, long length);
17 | int PDC_freeclipboard(char *contents);
18 | int PDC_clearclipboard(void);
19 |
20 | ### Description
21 |
22 | PDC_getclipboard() gets the textual contents of the system's
23 | clipboard. This function returns the contents of the clipboard in the
24 | contents argument. It is the responsibility of the caller to free the
25 | memory returned, via PDC_freeclipboard(). The length of the clipboard
26 | contents is returned in the length argument.
27 |
28 | PDC_setclipboard copies the supplied text into the system's
29 | clipboard, emptying the clipboard prior to the copy.
30 |
31 | PDC_clearclipboard() clears the internal clipboard.
32 |
33 | ### Return Values
34 |
35 | indicator of success/failure of call.
36 | PDC_CLIP_SUCCESS the call was successful
37 | PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
38 | the clipboard contents
39 | PDC_CLIP_EMPTY the clipboard contains no text
40 | PDC_CLIP_ACCESS_ERROR no clipboard support
41 |
42 | ### Portability
43 | X/Open ncurses NetBSD
44 | PDC_getclipboard - - -
45 | PDC_setclipboard - - -
46 | PDC_freeclipboard - - -
47 | PDC_clearclipboard - - -
48 |
49 | **man-end****************************************************************/
50 |
51 | /* global clipboard contents, should be NULL if none set */
52 |
53 | static char *pdc_SDL_clipboard = NULL;
54 |
55 | int PDC_getclipboard(char **contents, long *length)
56 | {
57 | int len;
58 |
59 | PDC_LOG(("PDC_getclipboard() - called\n"));
60 |
61 | if (!pdc_SDL_clipboard)
62 | return PDC_CLIP_EMPTY;
63 |
64 | len = strlen(pdc_SDL_clipboard);
65 | if ((*contents = malloc(len + 1)) == NULL)
66 | return PDC_CLIP_MEMORY_ERROR;
67 |
68 | strcpy(*contents, pdc_SDL_clipboard);
69 | *length = len;
70 |
71 | return PDC_CLIP_SUCCESS;
72 | }
73 |
74 | int PDC_setclipboard(const char *contents, long length)
75 | {
76 | PDC_LOG(("PDC_setclipboard() - called\n"));
77 |
78 | if (pdc_SDL_clipboard)
79 | {
80 | free(pdc_SDL_clipboard);
81 | pdc_SDL_clipboard = NULL;
82 | }
83 |
84 | if (contents)
85 | {
86 | if ((pdc_SDL_clipboard = malloc(length + 1)) == NULL)
87 | return PDC_CLIP_MEMORY_ERROR;
88 |
89 | strcpy(pdc_SDL_clipboard, contents);
90 | }
91 |
92 | return PDC_CLIP_SUCCESS;
93 | }
94 |
95 | int PDC_freeclipboard(char *contents)
96 | {
97 | PDC_LOG(("PDC_freeclipboard() - called\n"));
98 |
99 | /* should we also free empty the system clipboard? probably not */
100 |
101 | if (contents)
102 | {
103 | /* NOTE: We free the memory, but we can not set caller's pointer
104 | to NULL, so if caller calls again then will try to access
105 | free'd memory. We 1st overwrite memory with a string so if
106 | caller tries to use free memory they won't get what they
107 | expect & hopefully notice. */
108 |
109 | /* memset(contents, 0xFD, strlen(contents)); */
110 |
111 | if (strlen(contents) >= strlen("PDCURSES"))
112 | strcpy(contents, "PDCURSES");
113 |
114 | free(contents);
115 | }
116 |
117 | return PDC_CLIP_SUCCESS;
118 | }
119 |
120 | int PDC_clearclipboard(void)
121 | {
122 | PDC_LOG(("PDC_clearclipboard() - called\n"));
123 |
124 | if (pdc_SDL_clipboard)
125 | {
126 | free(pdc_SDL_clipboard);
127 | pdc_SDL_clipboard = NULL;
128 | }
129 |
130 | return PDC_CLIP_SUCCESS;
131 | }
132 |
--------------------------------------------------------------------------------
/lib/dos/pdcclip.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcdos.h"
4 |
5 | #include
6 |
7 | /*man-start**************************************************************
8 |
9 | clipboard
10 | ---------
11 |
12 | ### Synopsis
13 |
14 | int PDC_getclipboard(char **contents, long *length);
15 | int PDC_setclipboard(const char *contents, long length);
16 | int PDC_freeclipboard(char *contents);
17 | int PDC_clearclipboard(void);
18 |
19 | ### Description
20 |
21 | PDC_getclipboard() gets the textual contents of the system's
22 | clipboard. This function returns the contents of the clipboard in the
23 | contents argument. It is the responsibility of the caller to free the
24 | memory returned, via PDC_freeclipboard(). The length of the clipboard
25 | contents is returned in the length argument.
26 |
27 | PDC_setclipboard copies the supplied text into the system's
28 | clipboard, emptying the clipboard prior to the copy.
29 |
30 | PDC_clearclipboard() clears the internal clipboard.
31 |
32 | ### Return Values
33 |
34 | indicator of success/failure of call.
35 | PDC_CLIP_SUCCESS the call was successful
36 | PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
37 | the clipboard contents
38 | PDC_CLIP_EMPTY the clipboard contains no text
39 | PDC_CLIP_ACCESS_ERROR no clipboard support
40 |
41 | ### Portability
42 | X/Open ncurses NetBSD
43 | PDC_getclipboard - - -
44 | PDC_setclipboard - - -
45 | PDC_freeclipboard - - -
46 | PDC_clearclipboard - - -
47 |
48 | **man-end****************************************************************/
49 |
50 | /* global clipboard contents, should be NULL if none set */
51 |
52 | static char *pdc_DOS_clipboard = NULL;
53 |
54 | int PDC_getclipboard(char **contents, long *length)
55 | {
56 | int len;
57 |
58 | PDC_LOG(("PDC_getclipboard() - called\n"));
59 |
60 | if (!pdc_DOS_clipboard)
61 | return PDC_CLIP_EMPTY;
62 |
63 | len = strlen(pdc_DOS_clipboard);
64 | *contents = malloc(len + 1);
65 | if (!*contents)
66 | return PDC_CLIP_MEMORY_ERROR;
67 |
68 | strcpy(*contents, pdc_DOS_clipboard);
69 | *length = len;
70 |
71 | return PDC_CLIP_SUCCESS;
72 | }
73 |
74 | int PDC_setclipboard(const char *contents, long length)
75 | {
76 | PDC_LOG(("PDC_setclipboard() - called\n"));
77 |
78 | if (pdc_DOS_clipboard)
79 | {
80 | free(pdc_DOS_clipboard);
81 | pdc_DOS_clipboard = NULL;
82 | }
83 |
84 | if (contents)
85 | {
86 | pdc_DOS_clipboard = malloc(length + 1);
87 | if (!pdc_DOS_clipboard)
88 | return PDC_CLIP_MEMORY_ERROR;
89 |
90 | strcpy(pdc_DOS_clipboard, contents);
91 | }
92 |
93 | return PDC_CLIP_SUCCESS;
94 | }
95 |
96 | int PDC_freeclipboard(char *contents)
97 | {
98 | PDC_LOG(("PDC_freeclipboard() - called\n"));
99 |
100 | /* should we also free empty the system clipboard? probably not */
101 |
102 | if (contents)
103 | {
104 | /* NOTE: We free the memory, but we can not set caller's pointer
105 | to NULL, so if caller calls again then will try to access
106 | free'd memory. We 1st overwrite memory with a string so if
107 | caller tries to use free memory they won't get what they
108 | expect & hopefully notice. */
109 |
110 | /* memset(contents, 0xFD, strlen(contents)); */
111 |
112 | if (strlen(contents) >= strlen("PDCURSES"))
113 | strcpy(contents, "PDCURSES");
114 |
115 | free(contents);
116 | }
117 |
118 | return PDC_CLIP_SUCCESS;
119 | }
120 |
121 | int PDC_clearclipboard(void)
122 | {
123 | PDC_LOG(("PDC_clearclipboard() - called\n"));
124 |
125 | if (pdc_DOS_clipboard)
126 | {
127 | free(pdc_DOS_clipboard);
128 | pdc_DOS_clipboard = NULL;
129 | }
130 |
131 | return PDC_CLIP_SUCCESS;
132 | }
133 |
--------------------------------------------------------------------------------
/lib/wincon/pdcclip.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcwin.h"
4 |
5 | #include
6 |
7 | /*man-start**************************************************************
8 |
9 | clipboard
10 | ---------
11 |
12 | ### Synopsis
13 |
14 | int PDC_getclipboard(char **contents, long *length);
15 | int PDC_setclipboard(const char *contents, long length);
16 | int PDC_freeclipboard(char *contents);
17 | int PDC_clearclipboard(void);
18 |
19 | ### Description
20 |
21 | PDC_getclipboard() gets the textual contents of the system's
22 | clipboard. This function returns the contents of the clipboard in the
23 | contents argument. It is the responsibility of the caller to free the
24 | memory returned, via PDC_freeclipboard(). The length of the clipboard
25 | contents is returned in the length argument.
26 |
27 | PDC_setclipboard copies the supplied text into the system's
28 | clipboard, emptying the clipboard prior to the copy.
29 |
30 | PDC_clearclipboard() clears the internal clipboard.
31 |
32 | ### Return Values
33 |
34 | indicator of success/failure of call.
35 | PDC_CLIP_SUCCESS the call was successful
36 | PDC_CLIP_MEMORY_ERROR unable to allocate sufficient memory for
37 | the clipboard contents
38 | PDC_CLIP_EMPTY the clipboard contains no text
39 | PDC_CLIP_ACCESS_ERROR no clipboard support
40 |
41 | ### Portability
42 | X/Open ncurses NetBSD
43 | PDC_getclipboard - - -
44 | PDC_setclipboard - - -
45 | PDC_freeclipboard - - -
46 | PDC_clearclipboard - - -
47 |
48 | **man-end****************************************************************/
49 |
50 | #ifdef PDC_WIDE
51 | # define PDC_TEXT CF_UNICODETEXT
52 | #else
53 | # define PDC_TEXT CF_OEMTEXT
54 | #endif
55 |
56 | int PDC_getclipboard(char **contents, long *length)
57 | {
58 | HANDLE handle;
59 | long len;
60 |
61 | PDC_LOG(("PDC_getclipboard() - called\n"));
62 |
63 | if (!OpenClipboard(NULL))
64 | return PDC_CLIP_ACCESS_ERROR;
65 |
66 | if ((handle = GetClipboardData(PDC_TEXT)) == NULL)
67 | {
68 | CloseClipboard();
69 | return PDC_CLIP_EMPTY;
70 | }
71 |
72 | #ifdef PDC_WIDE
73 | len = wcslen((wchar_t *)handle) * 3;
74 | #else
75 | len = strlen((char *)handle);
76 | #endif
77 | *contents = (char *)GlobalAlloc(GMEM_FIXED, len + 1);
78 |
79 | if (!*contents)
80 | {
81 | CloseClipboard();
82 | return PDC_CLIP_MEMORY_ERROR;
83 | }
84 |
85 | #ifdef PDC_WIDE
86 | len = PDC_wcstombs((char *)*contents, (wchar_t *)handle, len);
87 | #else
88 | strcpy((char *)*contents, (char *)handle);
89 | #endif
90 | *length = len;
91 | CloseClipboard();
92 |
93 | return PDC_CLIP_SUCCESS;
94 | }
95 |
96 | int PDC_setclipboard(const char *contents, long length)
97 | {
98 | HGLOBAL ptr1;
99 | LPTSTR ptr2;
100 |
101 | PDC_LOG(("PDC_setclipboard() - called\n"));
102 |
103 | if (!OpenClipboard(NULL))
104 | return PDC_CLIP_ACCESS_ERROR;
105 |
106 | ptr1 = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
107 | (length + 1) * sizeof(TCHAR));
108 |
109 | if (!ptr1)
110 | return PDC_CLIP_MEMORY_ERROR;
111 |
112 | ptr2 = GlobalLock(ptr1);
113 |
114 | #ifdef PDC_WIDE
115 | PDC_mbstowcs((wchar_t *)ptr2, contents, length);
116 | #else
117 | memcpy((char *)ptr2, contents, length + 1);
118 | #endif
119 | GlobalUnlock(ptr1);
120 | EmptyClipboard();
121 |
122 | if (!SetClipboardData(PDC_TEXT, ptr1))
123 | {
124 | GlobalFree(ptr1);
125 | return PDC_CLIP_ACCESS_ERROR;
126 | }
127 |
128 | CloseClipboard();
129 | GlobalFree(ptr1);
130 |
131 | return PDC_CLIP_SUCCESS;
132 | }
133 |
134 | int PDC_freeclipboard(char *contents)
135 | {
136 | PDC_LOG(("PDC_freeclipboard() - called\n"));
137 |
138 | GlobalFree(contents);
139 | return PDC_CLIP_SUCCESS;
140 | }
141 |
142 | int PDC_clearclipboard(void)
143 | {
144 | PDC_LOG(("PDC_clearclipboard() - called\n"));
145 |
146 | EmptyClipboard();
147 |
148 | return PDC_CLIP_SUCCESS;
149 | }
150 |
--------------------------------------------------------------------------------
/lib/dos/pdcdisp.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include "pdcdos.h"
4 | #include "../common/acs437.h"
5 |
6 | /* position hardware cursor at (y, x) */
7 |
8 | void PDC_gotoyx(int row, int col)
9 | {
10 | PDCREGS regs;
11 |
12 | PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
13 |
14 | regs.h.ah = 0x02;
15 | regs.h.bh = 0;
16 | regs.h.dh = (unsigned char) row;
17 | regs.h.dl = (unsigned char) col;
18 | PDCINT(0x10, regs);
19 | }
20 |
21 | void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp)
22 | {
23 | attr_t sysattrs;
24 | int j;
25 | short fore, back;
26 | unsigned char mapped_attr;
27 |
28 | sysattrs = SP->termattrs;
29 | pair_content(PAIR_NUMBER(attr), &fore, &back);
30 |
31 | if (attr & A_BOLD)
32 | fore |= 8;
33 | if (attr & A_BLINK)
34 | back |= 8;
35 |
36 | fore = pdc_curstoreal[fore];
37 | back = pdc_curstoreal[back];
38 |
39 | if (attr & A_REVERSE)
40 | {
41 | if (sysattrs & A_BLINK)
42 | mapped_attr = (back & 7) | (((fore & 7) | (back & 8)) << 4);
43 | else
44 | mapped_attr = back | (fore << 4);
45 | }
46 | else
47 | {
48 | if ((attr & A_UNDERLINE) && (sysattrs & A_UNDERLINE))
49 | fore = (fore & 8) | 1;
50 |
51 | mapped_attr = fore | (back << 4);
52 | }
53 |
54 | if (pdc_direct_video)
55 | {
56 | #if SMALL || MEDIUM
57 | struct SREGS segregs;
58 | int ds;
59 | #endif
60 | /* this should be enough for the maximum width of a screen */
61 |
62 | struct {unsigned char text, attr;} temp_line[256];
63 |
64 | /* replace the attribute part of the chtype with the actual
65 | color value for each chtype in the line */
66 |
67 | for (j = 0; j < len; j++)
68 | {
69 | chtype ch = srcp[j];
70 |
71 | temp_line[j].attr = mapped_attr;
72 |
73 | if (ch & A_ALTCHARSET && !(ch & 0xff80))
74 | ch = acs_map[ch & 0x7f];
75 |
76 | temp_line[j].text = ch & 0xff;
77 | }
78 |
79 | #ifdef __DJGPP__
80 | dosmemput(temp_line, len * 2,
81 | (unsigned long)_FAR_POINTER(pdc_video_seg,
82 | pdc_video_ofs + (lineno * curscr->_maxx + x) * 2));
83 | #else
84 | # if SMALL || MEDIUM
85 | segread(&segregs);
86 | ds = segregs.ds;
87 | movedata(ds, (int)temp_line, pdc_video_seg,
88 | pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2);
89 | # else
90 | memcpy((void *)_FAR_POINTER(pdc_video_seg,
91 | pdc_video_ofs + (lineno * curscr->_maxx + x) * 2),
92 | temp_line, len * 2);
93 | # endif
94 | #endif
95 |
96 | }
97 | else
98 | for (j = 0; j < len;)
99 | {
100 | PDCREGS regs;
101 | unsigned short count = 1;
102 | chtype ch = srcp[j];
103 |
104 | while ((j + count < len) && (ch == srcp[j + count]))
105 | count++;
106 |
107 | PDC_gotoyx(lineno, j + x);
108 |
109 | regs.h.ah = 0x09;
110 | regs.W.bx = mapped_attr;
111 | regs.W.cx = count;
112 |
113 | if (ch & A_ALTCHARSET && !(ch & 0xff80))
114 | ch = acs_map[ch & 0x7f];
115 |
116 | regs.h.al = (unsigned char) (ch & 0xff);
117 |
118 | PDCINT(0x10, regs);
119 |
120 | j += count;
121 | }
122 | }
123 |
124 | /* update the given physical line to look like the corresponding line in
125 | curscr */
126 |
127 | void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
128 | {
129 | attr_t old_attr, attr;
130 | int i, j;
131 |
132 | PDC_LOG(("PDC_transform_line() - called: lineno=%d\n", lineno));
133 |
134 | old_attr = *srcp & (A_ATTRIBUTES ^ A_ALTCHARSET);
135 |
136 | for (i = 1, j = 1; j < len; i++, j++)
137 | {
138 | attr = srcp[i] & (A_ATTRIBUTES ^ A_ALTCHARSET);
139 |
140 | if (attr != old_attr)
141 | {
142 | _new_packet(old_attr, lineno, x, i, srcp);
143 | old_attr = attr;
144 | srcp += i;
145 | x += i;
146 | i = 0;
147 | }
148 | }
149 |
150 | _new_packet(old_attr, lineno, x, i, srcp);
151 | }
152 |
153 | void PDC_doupdate(void)
154 | {
155 | }
156 |
--------------------------------------------------------------------------------
/lib/pdcurses/getyx.c:
--------------------------------------------------------------------------------
1 | /* PDCurses */
2 |
3 | #include
4 |
5 | /*man-start**************************************************************
6 |
7 | getyx
8 | -----
9 |
10 | ### Synopsis
11 |
12 | void getyx(WINDOW *win, int y, int x);
13 | void getparyx(WINDOW *win, int y, int x);
14 | void getbegyx(WINDOW *win, int y, int x);
15 | void getmaxyx(WINDOW *win, int y, int x);
16 |
17 | void getsyx(int y, int x);
18 | void setsyx(int y, int x);
19 |
20 | int getbegy(WINDOW *win);
21 | int getbegx(WINDOW *win);
22 | int getcury(WINDOW *win);
23 | int getcurx(WINDOW *win);
24 | int getpary(WINDOW *win);
25 | int getparx(WINDOW *win);
26 | int getmaxy(WINDOW *win);
27 | int getmaxx(WINDOW *win);
28 |
29 | ### Description
30 |
31 | The getyx() macro (defined in curses.h -- the prototypes here are
32 | merely illustrative) puts the current cursor position of the
33 | specified window into y and x. getbegyx() and getmaxyx() return the
34 | starting coordinates and size of the specified window, respectively.
35 | getparyx() returns the starting coordinates of the parent's window,
36 | if the specified window is a subwindow; otherwise it sets y and x to
37 | -1. These are all macros.
38 |
39 | getsyx() gets the coordinates of the virtual screen cursor, and
40 | stores them in y and x. If leaveok() is TRUE, it returns -1, -1. If
41 | lines have been removed with ripoffline(), then getsyx() includes
42 | these lines in its count; so, the returned y and x values should only
43 | be used with setsyx().
44 |
45 | setsyx() sets the virtual screen cursor to the y, x coordinates. If
46 | either y or x is -1, leaveok() is set TRUE, else it's set FALSE.
47 |
48 | getsyx() and setsyx() are meant to be used by a library routine that
49 | manipulates curses windows without altering the position of the
50 | cursor. Note that getsyx() is defined only as a macro.
51 |
52 | getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), getmaxx(),
53 | getpary(), and getparx() return the appropriate coordinate or size
54 | values, or ERR in the case of a NULL window.
55 |
56 | ### Portability
57 | X/Open ncurses NetBSD
58 | getyx Y Y Y
59 | getparyx Y Y Y
60 | getbegyx Y Y Y
61 | getmaxyx Y Y Y
62 | getsyx - Y Y
63 | setsyx - Y Y
64 | getbegy - Y Y
65 | getbegx - Y Y
66 | getcury - Y Y
67 | getcurx - Y Y
68 | getpary - Y Y
69 | getparx - Y Y
70 | getmaxy - Y Y
71 | getmaxx - Y Y
72 |
73 | **man-end****************************************************************/
74 |
75 | int getbegy(WINDOW *win)
76 | {
77 | PDC_LOG(("getbegy() - called\n"));
78 |
79 | return win ? win->_begy : ERR;
80 | }
81 |
82 | int getbegx(WINDOW *win)
83 | {
84 | PDC_LOG(("getbegx() - called\n"));
85 |
86 | return win ? win->_begx : ERR;
87 | }
88 |
89 | int getcury(WINDOW *win)
90 | {
91 | PDC_LOG(("getcury() - called\n"));
92 |
93 | return win ? win->_cury : ERR;
94 | }
95 |
96 | int getcurx(WINDOW *win)
97 | {
98 | PDC_LOG(("getcurx() - called\n"));
99 |
100 | return win ? win->_curx : ERR;
101 | }
102 |
103 | int getpary(WINDOW *win)
104 | {
105 | PDC_LOG(("getpary() - called\n"));
106 |
107 | return win ? win->_pary : ERR;
108 | }
109 |
110 | int getparx(WINDOW *win)
111 | {
112 | PDC_LOG(("getparx() - called\n"));
113 |
114 | return win ? win->_parx : ERR;
115 | }
116 |
117 | int getmaxy(WINDOW *win)
118 | {
119 | PDC_LOG(("getmaxy() - called\n"));
120 |
121 | return win ? win->_maxy : ERR;
122 | }
123 |
124 | int getmaxx(WINDOW *win)
125 | {
126 | PDC_LOG(("getmaxx() - called\n"));
127 |
128 | return win ? win->_maxx : ERR;
129 | }
130 |
131 | void setsyx(int y, int x)
132 | {
133 | PDC_LOG(("setsyx() - called\n"));
134 |
135 | if (curscr)
136 | {
137 | curscr->_leaveit = y == -1 || x == -1;
138 |
139 | if (!curscr->_leaveit)
140 | wmove(curscr, y, x);
141 | }
142 | }
143 |
--------------------------------------------------------------------------------