]> gitweb.factorcode.org Git - factor.git/commitdiff
Split off baseline alignment code into ui.baseline-alignment, and add cap-height...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 17 Feb 2009 12:10:02 +0000 (06:10 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 17 Feb 2009 12:10:02 +0000 (06:10 -0600)
21 files changed:
basis/ui/baseline-alignment/authors.txt [new file with mode: 0644]
basis/ui/baseline-alignment/baseline-alignment-tests.factor [new file with mode: 0644]
basis/ui/baseline-alignment/baseline-alignment.factor [new file with mode: 0644]
basis/ui/gadgets/borders/borders.factor
basis/ui/gadgets/buttons/buttons-tests.factor
basis/ui/gadgets/debug/debug.factor
basis/ui/gadgets/editors/editors.factor
basis/ui/gadgets/gadgets-tests.factor
basis/ui/gadgets/gadgets.factor
basis/ui/gadgets/grids/grids.factor
basis/ui/gadgets/labels/labels.factor
basis/ui/gadgets/line-support/line-support.factor
basis/ui/gadgets/packs/packs-docs.factor
basis/ui/gadgets/packs/packs-tests.factor
basis/ui/gadgets/packs/packs.factor
basis/ui/gadgets/panes/panes.factor
basis/ui/gadgets/paragraphs/paragraphs.factor
basis/ui/gadgets/search-tables/search-tables.factor
basis/ui/gadgets/tables/tables.factor
basis/ui/gadgets/wrappers/wrappers.factor
basis/ui/tools/profiler/profiler.factor

diff --git a/basis/ui/baseline-alignment/authors.txt b/basis/ui/baseline-alignment/authors.txt
new file mode 100644 (file)
index 0000000..d4f5d6b
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
\ No newline at end of file
diff --git a/basis/ui/baseline-alignment/baseline-alignment-tests.factor b/basis/ui/baseline-alignment/baseline-alignment-tests.factor
new file mode 100644 (file)
index 0000000..ab749e5
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: tools.test math kernel sets generic
+ui.baseline-alignment ui.baseline-alignment.private ;
+IN: ui.baseline-alignment.tests
+
+! Test baseline calculations
+[ 10 ] [ 0 10 0 combine-metrics + ] unit-test
+[ 15 ] [ 0 10 5 combine-metrics + ] unit-test
+[ 30 ] [ 30 0 0 combine-metrics + ] unit-test
+[ 35 ] [ 10 0 30 combine-metrics + ] unit-test
+[ 20 ] [ 5 10 10 combine-metrics + ] unit-test
+[ 20 ] [ 20 10 0 combine-metrics + ] unit-test
+[ 55 ] [ 20 10 40 combine-metrics + ] unit-test
+
+[ t ] [ \ baseline \ cap-height [ order ] bi@ set= ] unit-test 
\ No newline at end of file
diff --git a/basis/ui/baseline-alignment/baseline-alignment.factor b/basis/ui/baseline-alignment/baseline-alignment.factor
new file mode 100644 (file)
index 0000000..f9dec64
--- /dev/null
@@ -0,0 +1,68 @@
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel locals math math.order math.vectors
+sequences ui.gadgets accessors ;
+IN: ui.baseline-alignment
+
+SYMBOL: +baseline+
+
+GENERIC: baseline ( gadget -- y )
+
+M: gadget baseline drop f ;
+
+GENERIC: cap-height ( gadget -- y )
+
+M: gadget cap-height drop f ;
+
+<PRIVATE
+
+! Text has ascent/descent/cap-height slots, graphics does not.
+TUPLE: gadget-metrics height ascent descent cap-height ;
+
+: <gadget-metrics> ( gadget dim -- metrics )
+    second swap [ baseline ] [ cap-height ] bi
+    [ dup [ 2dup - ] [ f ] if ] dip
+    gadget-metrics boa ; inline
+
+: max-ascent ( seq -- n )
+    0 [ ascent>> [ max ] when* ] reduce ; inline
+
+: max-descent ( seq -- n )
+    0 [ descent>> [ max ] when* ] reduce ; inline
+
+: max-text-height ( seq -- y )
+    0 [ [ height>> ] [ ascent>> ] bi [ max ] [ drop ] if ] reduce ;
+
+: max-graphics-height ( seq -- y )
+    0 [ [ height>> ] [ ascent>> ] bi [ drop ] [ max ] if ] reduce ;
+
+: combine-metrics ( graphics-height ascent descent -- ascent' descent' )
+    [ [ [-] 2 /i ] keep ] dip [ + ] [ max ] bi-curry* bi ;
+
+PRIVATE>
+
+:: align-baselines ( gadgets -- ys )
+    gadgets [ dup pref-dim <gadget-metrics> ] map
+    dup max-ascent :> max-ascent
+    dup max-graphics-height :> max-height
+    max-height max-ascent [-] 2 /i :> offset-text
+    max-ascent max-height [-] 2 /i :> offset-graphics
+    [
+        dup ascent>> [
+            ascent>>
+            max-ascent
+            offset-text
+        ] [
+            height>>
+            max-height
+            offset-graphics
+        ] if [ swap - ] dip +
+    ] map ;
+
+: measure-metrics ( children sizes -- ascent descent )
+    [ <gadget-metrics> ] 2map
+    [ max-graphics-height ] [ max-ascent ] [ max-descent ] tri
+    combine-metrics ;
+
+: measure-height ( children sizes -- height )
+    measure-metrics + ;
\ No newline at end of file
index ae44163ea5d582d74700760017f6bbe4c32f46b2..90de5a92877d323282b053dff9b5280947db2e1d 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays ui.gadgets kernel math fry
+USING: accessors arrays ui.gadgets ui.baseline-alignment kernel math fry
 namespaces vectors sequences math.vectors math.rectangles ;
 IN: ui.gadgets.borders
 
@@ -26,10 +26,6 @@ TUPLE: border < gadget
 M: border pref-dim*
     dup gadget-child pref-dim border-pref-dim ;
 
-M: border baseline
-    [ size>> second ] [ gadget-child baseline ] bi
-    dup [ + ] [ nip ] if ;
-
 <PRIVATE
 
 : border-major-dim ( border -- dim )
@@ -51,8 +47,16 @@ M: border baseline
 : border-child-rect ( border -- rect )
     dup border-dim [ border-loc ] keep <rect> ;
 
+: border-metric ( border quot -- n )
+    [ drop size>> second ] [ [ gadget-child ] dip call ] 2bi
+    dup [ + ] [ nip ] if ; inline
+
 PRIVATE>
 
+M: border baseline [ baseline ] border-metric ;
+
+M: border cap-height [ cap-height ] border-metric ;
+
 M: border layout*
     [ border-child-rect ] [ gadget-child ] bi set-rect-bounds ;
 
index 37af24ae25759f00e0d004626f5f0bf45715df2e..6d1706ee748fdc4552bf4455ba5f15a182ef1404 100644 (file)
@@ -30,8 +30,6 @@ T{ foo-gadget } <toolbar> "t" set
 
 \ <radio-buttons> must-infer
 
-\ <toggle-buttons> must-infer
-
 \ <checkbox> must-infer
 
 [ 0 ] [
index 3c66d06a16f08480b95ec136667c61a67be4e0b4..800fdc850e5523bbf17bbb89181f630c146d5fee 100644 (file)
@@ -1,12 +1,15 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors ui ui.gadgets ui.gadgets.buttons ui.render ;
+USING: kernel accessors sequences ui ui.gadgets ui.gadgets.buttons
+ui.baseline-alignment ui.render ;
 IN: ui.gadgets.debug
 
 TUPLE: baseline-gadget < gadget baseline ;
 
 M: baseline-gadget baseline baseline>> ;
 
+M: baseline-gadget cap-height dim>> second ;
+
 : <baseline-gadget> ( baseline dim -- gadget )
     baseline-gadget new
         swap >>dim
index 76036c19fc26704bc4a29d5ae7252f0462675e71..1cb2e2a51de904379a85dd315ed1513720bbd452 100755 (executable)
@@ -6,8 +6,8 @@ opengl.gl sequences strings math.vectors math.functions sorting colors
 colors.constants combinators assocs math.order fry calendar alarms
 continuations ui.clipboards ui.commands ui.gadgets ui.gadgets.borders
 ui.gadgets.buttons ui.gadgets.labels ui.gadgets.scrollers
-ui.gadgets.menus ui.gadgets.wrappers ui.render
-ui.pens.solid ui.gadgets.line-support ui.text ui.gestures
+ui.gadgets.menus ui.gadgets.wrappers ui.render ui.pens.solid
+ui.gadgets.line-support ui.text ui.gestures ui.baseline-alignment
 math.rectangles splitting unicode.categories fonts grouping ;
 IN: ui.gadgets.editors
 
@@ -199,8 +199,9 @@ M: editor draw-gadget*
 M: editor pref-dim*
     [ font>> ] [ control-value ] bi text-dim ;
 
-M: editor baseline
-    font>> font-metrics ascent>> ;
+M: editor baseline font>> font-metrics ascent>> ;
+
+M: editor cap-height font>> font-metrics cap-height>> ;
 
 : contents-changed ( model editor -- )
     swap
@@ -482,7 +483,7 @@ TUPLE: multiline-editor < editor ;
 
 <PRIVATE
 
-: page-elt ( editor -- editor element ) dup visible-lines <page-elt> ;
+: page-elt ( editor -- editor element ) dup visible-lines 1- <page-elt> ;
 
 PRIVATE>
 
index 2bfa2fb52a26b433b66a04f00135178b6b426f62..baeb320447ec129ddbca4986f26b4a685ca571ea 100644 (file)
@@ -1,7 +1,8 @@
 USING: accessors ui.gadgets ui.gadgets.private ui.gadgets.packs
 ui.gadgets.worlds tools.test namespaces models kernel dlists deques
 math sets math.parser ui sequences hashtables assocs io arrays
-prettyprint io.streams.string math.rectangles ui.gadgets.private ;
+prettyprint io.streams.string math.rectangles ui.gadgets.private
+sets generic ;
 IN: ui.gadgets.tests
 
 [ { 300 300 } ]
@@ -163,13 +164,4 @@ M: mock-gadget ungraft*
 \ pref-dim must-infer
 
 \ graft* must-infer
-\ ungraft* must-infer
-
-! Test baseline calculations
-[ 10 ] [ 0 10 0 combine-baseline-metrics + ] unit-test
-[ 15 ] [ 0 10 5 combine-baseline-metrics + ] unit-test
-[ 30 ] [ 30 0 0 combine-baseline-metrics + ] unit-test
-[ 35 ] [ 10 0 30 combine-baseline-metrics + ] unit-test
-[ 20 ] [ 5 10 10 combine-baseline-metrics + ] unit-test
-[ 20 ] [ 20 10 0 combine-baseline-metrics + ] unit-test
-[ 55 ] [ 20 10 40 combine-baseline-metrics + ] unit-test
\ No newline at end of file
+\ ungraft* must-infer
\ No newline at end of file
index 967b14da789d9a8081404eadf8d6340d3daa85f0..ffcd2ac1a5434665c19978785ac5f8ca3d7e3824 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors arrays hashtables kernel models math namespaces
 make sequences quotations math.vectors combinators sorting
 binary-search vectors dlists deques models threads
-concurrency.flags math.order math.rectangles fry locals ;
+concurrency.flags math.order math.rectangles fry ;
 IN: ui.gadgets
 
 ! Values for orientation slot
@@ -191,54 +191,6 @@ GENERIC: pref-dim* ( gadget -- dim )
 
 M: gadget pref-dim* dim>> ;
 
-SYMBOL: +baseline+
-
-GENERIC: baseline ( gadget -- y )
-
-M: gadget baseline drop f ;
-
-: (max-ascent-and-descent) ( accum baseline height -- accum' )
-    over [ over - 2array vmax ] [ 2drop ] if ;
-
-: max-ascent-and-descent ( baselines heights -- ascent descent )
-    { 0 0 } [ (max-ascent-and-descent) ] 2reduce first2 ;
-
-: max-height-with-baseline ( baselines heights -- y )
-    0 [ swap [ max ] [ drop ] if ] 2reduce ;
-
-: max-height-without-baseline ( baselines heights -- y )
-    0 [ swap [ drop ] [ max ] if ] 2reduce ;
-
-:: baseline-align ( gadgets -- ys )
-    gadgets [ [ baseline ] map ] [ [ pref-dim second ] map ] bi
-    over 0 [ [ max ] when* ] reduce :> max-baseline
-    2dup max-height-without-baseline :> max-height-without-baseline
-    max-height-without-baseline max-baseline [-] 2 /i :> offset-with-baseline
-    max-baseline max-height-without-baseline [-] 2 /i :> offset-without-baseline
-    [
-        over [
-            drop
-            max-baseline
-            offset-with-baseline
-        ] [
-            nip
-            max-height-without-baseline
-            offset-without-baseline
-        ] if [ swap - ] dip +
-    ] 2map ;
-
-: combine-baseline-metrics ( height ascent descent -- ascent' descent' )
-    [ [ [-] 2 /i ] keep ] dip [ + ] [ max ] bi-curry* bi ;
-
-: baseline-metrics ( children sizes -- ascent descent )
-    #! Consider gadgets with a baseline and those without separately.
-    [ [ baseline ] map ] [ [ second ] map ] bi*
-    [ max-height-without-baseline ] [ max-ascent-and-descent ] 2bi
-    combine-baseline-metrics ;
-
-: baseline-height ( children sizes -- height )
-    baseline-metrics + ;
-
 GENERIC: layout* ( gadget -- )
 
 M: gadget layout* drop ;
index dc4217438e6a0b8ec9fbce6c863d16fd69fd3375..4ab080464b748421521f9a5c1172602772d9bf84 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays kernel math math.order namespaces make sequences words io
-math.vectors ui.gadgets columns accessors strings.tables
+math.vectors ui.gadgets ui.baseline-alignment columns accessors strings.tables
 math.rectangles fry ;
 IN: ui.gadgets.grids
 
@@ -36,12 +36,15 @@ PRIVATE>
 : cross-zip ( seq1 seq2 -- seq1xseq2 )
     [ [ 2array ] with map ] curry map ;
 
-TUPLE: cell pref-dim baseline ;
+TUPLE: cell pref-dim baseline cap-height ;
 
-: <cell> ( gadget -- cell ) [ pref-dim ] [ baseline ] bi cell boa ;
+: <cell> ( gadget -- cell )
+    [ pref-dim ] [ baseline ] [ cap-height ] tri cell boa ;
 
 M: cell baseline baseline>> ;
 
+M: cell cap-height cap-height>> ;
+
 TUPLE: grid-layout grid gap fill? row-heights column-widths ;
 
 : iterate-cell-dims ( cells quot -- seq )
@@ -50,7 +53,7 @@ TUPLE: grid-layout grid gap fill? row-heights column-widths ;
 : row-heights ( grid-layout -- heights )
     [ grid>> ] [ fill?>> ] bi
     [ [ second ] iterate-cell-dims ]
-    [ [ dup [ pref-dim>> ] map baseline-height ] map ]
+    [ [ dup [ pref-dim>> ] map measure-height ] map ]
     if ;
 
 : column-widths ( grid-layout -- widths )
@@ -90,7 +93,7 @@ M: grid pref-dim* <grid-layout> grid-pref-dim ;
     bi cross-zip flip ;
 
 : adjust-for-baseline ( row-locs row-cells -- row-locs' )
-    baseline-align [ 0 swap 2array v+ ] 2map ;
+    align-baselines [ 0 swap 2array v+ ] 2map ;
 
 : cell-locs ( grid-layout -- locs )
     dup fill?>>
index 37406548984a01666abdfe33028096d74f0bc615..eb992f1428b376bdaf99c2a127dedff54c9fad85 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors arrays hashtables io kernel math math.functions
 namespaces make opengl sequences strings splitting ui.gadgets
 ui.gadgets.tracks ui.gadgets.packs fonts ui.render ui.pens.solid
-ui.text colors colors.constants models combinators ;
+ui.baseline-alignment ui.text colors colors.constants models
+combinators ;
 IN: ui.gadgets.labels
 
 ! A label gadget draws a string.
@@ -51,9 +52,18 @@ M: label (>>string) ( string label -- )
 M: label pref-dim*
     >label< text-dim ;
 
+<PRIVATE
+
+: label-metrics ( label -- metrics )
+    >label< dup string? [ first ] unless line-metrics ;
+
+PRIVATE>
+
 M: label baseline
-    >label< dup string? [ first ] unless
-    line-metrics ascent>> round ;
+    label-metrics ascent>> round ;
+
+M: label cap-height
+    label-metrics cap-height>> round ;
 
 M: label draw-gadget*
     >label<
index 5d12d9e75c79658dec8ad59cd9956be725ad0d3a..87155fa018d4d1500f5e234c67ee0ca369a2e347 100644 (file)
@@ -82,4 +82,4 @@ M: line-gadget pref-viewport-dim
     2bi 2array ;
 
 : visible-lines ( gadget -- n )
-    [ visible-dim second ] [ line-height ] bi /i 1- ;
\ No newline at end of file
+    [ visible-dim second ] [ line-height ] bi /i ;
\ No newline at end of file
index 40e41ae01db981689649556937edcec059c47301..938a8bf74073f4f468f11174cacd54bfd4fda0cf 100644 (file)
@@ -1,5 +1,6 @@
 USING: ui.gadgets help.markup help.syntax generic kernel
-classes.tuple quotations ui.gadgets.packs.private ;
+classes.tuple quotations ui.gadgets.packs.private
+ui.baseline-alignment ;
 IN: ui.gadgets.packs
 
 ARTICLE: "ui-pack-layout" "Pack layouts"
index 5d44386eda71b73fdbc4f460d6e4049fe3929730..cf95380de27d77dc0cc26793574b933965b1ead2 100644 (file)
@@ -1,6 +1,7 @@
-USING: ui.gadgets.packs ui.gadgets.packs.private ui.gadgets.labels
-ui.gadgets ui.gadgets.debug ui.render kernel namespaces tools.test
-math.parser sequences math.rectangles accessors ;
+USING: ui.gadgets.packs ui.gadgets.packs.private
+ui.gadgets.labels ui.gadgets ui.gadgets.debug ui.render
+ui.baseline-alignment kernel namespaces tools.test math.parser
+sequences math.rectangles accessors ;
 IN: ui.gadgets.packs.tests
 
 [ t ] [
index b23f0474f906de720f7c22c7379fabc8c989a1b1..2176b63b766d043371fd1a6a4043a1bdf8632732 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: sequences ui.gadgets kernel math math.functions
-math.vectors math.order math.rectangles namespaces accessors
-fry combinators arrays ;
+USING: sequences ui.gadgets ui.baseline-alignment kernel math
+math.functions math.vectors math.order math.rectangles namespaces
+accessors fry combinators arrays ;
 IN: ui.gadgets.packs
 
 TUPLE: pack < gadget
@@ -26,7 +26,7 @@ TUPLE: pack < gadget
     [ align>> ] [ dim>> ] bi '[ [ _ _ ] dip v- [ * >integer ] with map ] map ;
 
 : baseline-aligned-locs ( pack -- seq )
-    children>> baseline-align [ 0 swap 2array ] map ;
+    children>> align-baselines [ 0 swap 2array ] map ;
 
 : aligned-locs ( sizes pack -- seq )
     dup align>> +baseline+ eq?
@@ -66,7 +66,7 @@ PRIVATE>
 
 : max-pack-dim ( pack sizes -- dim )
     over align>> +baseline+ eq?
-    [ [ children>> ] dip baseline-height 0 swap 2array ] [ nip max-dim ] if ;
+    [ [ children>> ] dip measure-height 0 swap 2array ] [ nip max-dim ] if ;
 
 : pack-pref-dim ( pack sizes -- dim )
     [ max-pack-dim ]
@@ -78,10 +78,13 @@ M: pack pref-dim*
     dup children>> pref-dims pack-pref-dim ;
 
 : vertical-baseline ( pack -- y )
-    children>> [ 0 ] [ first baseline ] if-empty ;
+    children>> [ f ] [ first baseline ] if-empty ;
 
 : horizontal-baseline ( pack -- y )
-    children>> dup pref-dims baseline-metrics drop ;
+    children>> dup pref-dims measure-metrics drop ;
+
+: pack-cap-height ( pack -- n )
+    children>> [ f ] [ first cap-height ] if-empty ;
 
 PRIVATE>
 
@@ -91,6 +94,8 @@ M: pack baseline
         { horizontal [ horizontal-baseline ] }
     } case ;
 
+M: pack cap-height pack-cap-height ;
+
 M: pack layout*
     dup children>> pref-dims pack-layout ;
 
index 530bbaef4917cc80132d37be4bdb1aa373e9c440..383d96753f7666b28351928aeaddab6f5ac5dd5d 100644 (file)
@@ -9,7 +9,8 @@ ui.gadgets.buttons ui.gadgets.labels ui.gadgets.scrollers
 ui.gadgets.paragraphs ui.gadgets.incremental ui.gadgets.packs
 ui.gadgets.menus ui.clipboards ui.gestures ui.traverse ui.render
 ui.text ui.gadgets.presentations ui.gadgets.grids ui.gadgets.tracks
-ui.gadgets.icons ui.gadgets.grid-lines colors call io.styles ;
+ui.gadgets.icons ui.gadgets.grid-lines ui.baseline-alignment
+colors call io.styles ;
 IN: ui.gadgets.panes
 
 TUPLE: pane < pack
index f55e67f131bdcf36f4e1d4ae7bd8e2bbf2c8d559..fd5ae0b246646f81f3745a2036d54d4a3ebf1f3f 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2005, 2009 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel math math.order sequences wrap wrap.words
-arrays fry ui.gadgets ui.gadgets.labels ui.render ;
+arrays fry ui.gadgets ui.gadgets.labels ui.gadgets.packs.private
+ui.render ui.baseline-alignment ;
 IN: ui.gadgets.paragraphs
 
 MIXIN: word-break
@@ -32,7 +33,7 @@ TUPLE: paragraph < gadget margin ;
 TUPLE: line words height ;
 
 : <line> ( words -- line )
-    dup [ key>> ] map dup pref-dims baseline-height line boa ;
+    dup [ key>> ] map dup pref-dims measure-height line boa ;
 
 : wrap-paragraph ( paragraph -- wrapped-paragraph )
     [ children>> [ gadget>word ] map ] [ margin>> ] bi
@@ -64,7 +65,7 @@ M: paragraph pref-dim*
         words>>
         [ ]
         [ word-x-coordinates ]
-        [ [ key>> ] map baseline-align ] tri
+        [ [ key>> ] map align-baselines ] tri
     ] dip '[ _ + layout-word ] 3each ;
 
 M: paragraph layout*
@@ -76,7 +77,9 @@ M: paragraph baseline
         first words>>
         [ key>> ] map
         dup [ pref-dim ] map
-        baseline-metrics drop
+        measure-metrics drop
     ] if-empty ;
 
+M: paragraph cap-height pack-cap-height ;
+    
 PRIVATE>
\ No newline at end of file
index 24343c4180753457b2e2aa13b00baa07daa89e30..e278f3bc75db3df6102e34a5e403d14d5b91cbe3 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2008, 2009 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel delegate fry sequences models models.search
-models.delay calendar locals ui.pens ui.pens.image ui.gadgets.editors
-ui.gadgets.labels ui.gadgets.scrollers ui.gadgets.tables
-ui.gadgets.tracks ui.gadgets.borders ui.gadgets.buttons ui.gadgets ;
+USING: accessors kernel delegate fry sequences models
+models.search models.delay calendar locals ui.pens ui.pens.image
+ui.gadgets.editors ui.gadgets.labels ui.gadgets.scrollers
+ui.gadgets.tables ui.gadgets.tracks ui.gadgets.borders
+ui.gadgets.buttons ui.baseline-alignment ui.gadgets ;
 IN: ui.gadgets.search-tables
 
 TUPLE: search-field < track field ;
index de967e1212d34611920e323d84a48117e394ee13..ee605185eca21668d861913d1943911a625f7c5f 100644 (file)
@@ -306,7 +306,7 @@ PRIVATE>
     dup control-value length 1- select-row ;
 
 : prev/next-page ( table n -- )
-    over visible-lines * prev/next-row ;
+    over visible-lines 1- * prev/next-row ;
 
 : previous-page ( table -- )
     -1 prev/next-page ;
index 53010a3fed31bfe09f28af8ad1b27c8672f9cc3f..fdcede7f235ef42c14e85948c09e49d1443e8e4c 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors ui.gadgets kernel ;
+USING: accessors kernel ui.gadgets ui.baseline-alignment ;
 IN: ui.gadgets.wrappers
 
 TUPLE: wrapper < gadget ;
@@ -14,6 +14,8 @@ M: wrapper pref-dim* gadget-child pref-dim ;
 
 M: wrapper baseline gadget-child baseline ;
 
+M: wrapper cap-height gadget-child cap-height ;
+
 M: wrapper layout* [ gadget-child ] [ dim>> ] bi >>dim drop ;
 
 M: wrapper focusable-child* gadget-child ;
index 71c931e7e5e637c853533f446779574d4db83ab3..86a7538b3af215bb52b63708944efe677530d469 100644 (file)
@@ -1,14 +1,14 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel quotations accessors fry
-assocs present math.order math.vectors arrays locals
-models.search models.sort models sequences vocabs
-tools.profiler words prettyprint ui ui.commands ui.gadgets
-ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks ui.gestures
-ui.gadgets.buttons ui.gadgets.tables ui.gadgets.search-tables
-ui.gadgets.labeled ui.gadgets.buttons ui.gadgets.packs
-ui.gadgets.labels ui.gadgets.tabbed ui.gadgets.status-bar
-ui.gadgets.borders ui.tools.browser ui.tools.common ;
+USING: kernel quotations accessors fry assocs present math.order
+math.vectors arrays locals models.search models.sort models
+sequences vocabs tools.profiler words prettyprint ui ui.commands
+ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
+ui.gadgets.tracks ui.gestures ui.gadgets.buttons
+ui.gadgets.tables ui.gadgets.search-tables ui.gadgets.labeled
+ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels
+ui.gadgets.tabbed ui.gadgets.status-bar ui.gadgets.borders
+ui.tools.browser ui.tools.common ui.baseline-alignment ;
 FROM: models.filter => <filter> ;
 FROM: models.compose => <compose> ;
 IN: ui.tools.profiler