]> gitweb.factorcode.org Git - factor.git/commitdiff
curses: add box word, rearrange some code
authorPhilipp Brüschweiler <blei42@gmail.com>
Sun, 25 Oct 2009 22:03:03 +0000 (23:03 +0100)
committerPhilipp Brüschweiler <blei42@gmail.com>
Sun, 3 Oct 2010 11:16:31 +0000 (13:16 +0200)
extra/curses/curses.factor
extra/curses/ffi/ffi.factor

index cd55cba1a0bfdf32dc25c692773f84a7918fe58b..5c4a58e9369cb2e5683e3cecf9be95682022a70c 100644 (file)
@@ -254,7 +254,7 @@ PRIVATE>
             ptr>> swap window-params ffi:derwin
         ] [
             window-params ffi:newwin
-        ] if* [ curses-error ] keep >>ptr &dispose
+        ] if* curses-pointer-error >>ptr &dispose
     ] [ apply-window-options ] bi ;
 
 : with-window ( window quot -- )
@@ -266,9 +266,13 @@ PRIVATE>
         '[
             ffi:initscr curses-pointer-error
             >>ptr
-            [ apply-global-options ] [ apply-window-options ] [ ] tri
-
-            ffi:erase curses-error
+            {
+                [ apply-global-options ]
+                [ apply-window-options ]
+                [ ptr>> ffi:wclear curses-error ]
+                [ ptr>> ffi:wrefresh curses-error ]
+                [ ]
+            } cleave
             init-colors
 
             _ with-window
@@ -402,3 +406,9 @@ PRIVATE>
 
 : ccolor ( foreground background -- )
     current-window get wccolor ;
+
+: wccbox ( window -- )
+    ptr>> 0 0 ffi:box curses-error ;
+: cbox ( -- )
+    current-window get wccbox ;
+
index 2941f66765d0dbfe1e02fda23ececa9569d723f7..a9ab937814dd489754fe03a8641688164fb49cb1 100644 (file)
@@ -274,3 +274,8 @@ FUNCTION: bool wenclose ( WINDOW* win, int y, int x ) ;
 FUNCTION: bool mouse_trafo ( int* pY, int* pX, bool to_screen ) ;
 FUNCTION: bool wmouse_trafo ( WINDOW* win, int* pY, int* pX, bool to_screen ) ;
 FUNCTION: int mouseinterval ( int erval ) ;
+
+FUNCTION: int wborder ( WINDOW* win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br ) ;
+FUNCTION: int box ( WINDOW* win, chtype verch, chtype horch ) ;
+FUNCTION: int whline ( WINDOW* win, chtype ch, int n ) ;
+FUNCTION: int wvline ( WINDOW* win, chtype ch, int n ) ;