]> gitweb.factorcode.org Git - factor.git/commitdiff
minor UI cleanups; phasing out x and y variables
authorSlava Pestov <slava@factorcode.org>
Tue, 19 Jul 2005 21:31:01 +0000 (21:31 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 19 Jul 2005 21:31:01 +0000 (21:31 +0000)
TODO.FACTOR.txt
library/syntax/parse-words.factor
library/ui/paint.factor
library/ui/text.factor

index f878760137fcea3c1f5d26e92362b9aeea2385eb..2af71916f1164fbe9c0704cde68c3bb52574a723 100644 (file)
@@ -11,7 +11,7 @@
 - gaps in pack layout\r
 - fix listener prompt display after presentation commands invoked\r
 - tutorial: clickable code snippets\r
-- parser::skip clean up\r
+- theme abstraction in ui\r
 \r
 + misc\r
 \r
index 64f9deee2262477d3fba571fac9f627cfcecf707..98f84113e273e3f950289f2af4fecbfdd9229275 100644 (file)
@@ -22,34 +22,22 @@ strings unparser words ;
 SYMBOL: file
 
 : skip ( i seq quot -- n | quot: elt -- ? )
-    #! Find the next element starting at i that satisfies the
-    #! quotation.
-    >r 2dup length < [
-        2dup nth r> dup >r call [
-            r> 2drop
-        ] [
-            >r 1 + r> r> skip
-        ] ifte
-    ] [
-        r> drop nip length
-    ] ifte ; inline
-
-: (skip-blank) ( n line -- n )
-    [ blank? not ] skip ;
+    over >r find* drop dup -1 =
+    [ drop r> length ] [ r> drop ] ifte ; inline
 
 : skip-blank ( -- )
-    "col" [ "line" get (skip-blank) ] change ;
+    "col" [ "line" get [ blank? not ] skip ] change ;
 
 : skip-word ( n line -- n )
     2dup nth CHAR: " = [ drop 1 + ] [ [ blank? ] skip ] ifte ;
 
 : (scan) ( n line -- start end )
-    [ (skip-blank) dup ] keep
-    2dup length < [ skip-word ] [ drop ] ifte ;
+    dupd 2dup length < [ skip-word ] [ drop ] ifte ;
 
 : scan ( -- token )
-    "col" get "line" get dup >r (scan) dup "col" set
-    2dup = [ r> 3drop f ] [ r> subseq ] ifte ;
+    skip-blank
+    "col" [ "line" get (scan) dup ] change
+    2dup = [ 2drop f ] [ "line" get subseq ] ifte ;
 
 : save-location ( word -- )
     #! Remember where this word was defined.
index 01a18e4b6806faa727400f8c1246ed2f372c454d..3a0f7a11ef870fa0a2695f7057c8902eed8b0f41 100644 (file)
@@ -7,8 +7,7 @@ namespaces sdl sequences strings styles vectors ;
 SYMBOL: clip
 
 : >sdl-rect ( rectangle -- sdlrect )
-    [ shape-x ] keep [ shape-y ] keep [ shape-w ] keep shape-h
-    make-rect ;
+    [ rectangle-loc 2unseq ] keep rectangle-dim 2unseq make-rect ;
 
 : set-clip ( rect -- ? )
     #! The top/left corner of the clip rectangle is the location
@@ -75,8 +74,7 @@ M: f draw-boundary 2drop ;
 TUPLE: solid ;
 
 : rect>screen ( shape -- x1 y1 x2 y2 )
-    >r x get y get r> dup shape-w swap shape-h
-    >r pick + r> pick + ;
+    >r origin dup r> rectangle-dim v+ >r 2unseq r> 2unseq ;
 
 ! Solid pen
 M: solid draw-interior
index cd1bb75276e7c20973b571a926e28534ad8a12d5..4a8cadb4d52fbaefa3f42c638f175f620c1a2e81 100644 (file)
@@ -34,6 +34,6 @@ strings styles io ;
         >r [ gadget-font ] keep r> swap
         fg 3unlist make-color
         TTF_RenderUNICODE_Blended
-        [ >r x get y get r> draw-surface ] keep
+        [ >r origin 2unseq r> draw-surface ] keep
         SDL_FreeSurface
     ] ifte ;