]> gitweb.factorcode.org Git - factor.git/commitdiff
Various UI cosmetic fixes
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 15 Feb 2009 02:46:35 +0000 (20:46 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 15 Feb 2009 02:46:35 +0000 (20:46 -0600)
basis/ui/gadgets/editors/editors.factor
basis/ui/gadgets/labeled/labeled-docs.factor
basis/ui/gadgets/labels/labels.factor
basis/ui/gadgets/line-support/line-support.factor
basis/ui/gadgets/menus/menus.factor
basis/ui/gadgets/packs/packs.factor
basis/ui/gadgets/panes/panes.factor
basis/ui/render/render.factor
basis/ui/tools/browser/browser.factor

index 6b542053061ef93d395b85aa3065f12705706cce..d6dcf32f73de9ac33fd08858d5858357851c6611 100755 (executable)
@@ -130,7 +130,7 @@ M: editor ungraft*
     [ first2 swap ] dip [ editor-line ] [ font>> ] bi swap offset>x round ;
 
 : loc>point ( loc editor -- loc )
-    [ loc>x ] [ [ first ] dip line>y ] 2bi 2array ;
+    [ loc>x ] [ [ first ] dip line>y ceiling ] 2bi 2array ;
 
 : caret-loc ( editor -- loc )
     [ editor-caret ] keep loc>point ;
index c89392b836a817b6865cc233e671d02fbc2848af..c5b80a3cbb15235785a27d0b60456bca3adcf999 100644 (file)
@@ -9,12 +9,6 @@ HELP: <labeled-gadget>
 { $values { "gadget" gadget } { "title" string } { "newgadget" "a new " { $link <labeled-gadget> } } }
 { $description "Creates a new " { $link labeled-gadget } " display " { $snippet "gadget" } " with " { $snippet "title" } " on top." } ;
 
-HELP: <labeled-pane>
-{ $values { "model" model } { "quot" { $quotation "( value -- )" } } { "scrolls?" "a boolean" } { "title" string } { "gadget" "a new " { $link gadget } } }
-{ $description "Creates a new control delegating to a " { $link pane } ", and wraps it in a " { $link labeled-gadget } ". When the value of the model changes, the value is pushed on the stack and the quotation is called using " { $link with-pane } "." } ;
-
-{ <labeled-pane> <pane-control> } related-words
-
 ARTICLE: "ui.gadgets.labeled" "Labelled gadgets"
 "The " { $vocab-link "ui.gadgets.labeled" } " vocabulary implements labeled borders around child gadgets."
 { $subsection labeled-gadget }
index 4619aecbf28e8b9616264f2f89c5a9d8b15d6262..ae784b6983a4e354dd7f74562e78e69ba49533fc 100644 (file)
@@ -85,6 +85,7 @@ M: f >label drop <gadget> ;
 
 : label-on-left/right ( -- track )
     horizontal <track>
+        0 >>fill
         +baseline+ >>align
         { 5 5 } >>gap ; inline
 PRIVATE>
index cea36a57e7a0526b6a48cfa065e8be4bada2f9e2..0aacf9445ad8bd0e13b953de312e1bc5f0467a0e 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays combinators fry kernel math math.order
+USING: accessors arrays combinators fry kernel math math.functions math.order
 math.ranges math.vectors namespaces opengl sequences ui.gadgets
 ui.render ui.text ;
 IN: ui.gadgets.line-support
@@ -18,7 +18,7 @@ M: gadget line-height font>> font-metrics height>> ;
 
 : y>line ( y gadget -- n ) line-height /i ;
 
-: line>y ( n gadget -- y ) line-height * ;
+: line>y ( n gadget -- y ) line-height * >integer ;
 
 : validate-line ( m gadget -- n )
     control-value [ drop f ] [ length 1- min 0 max ] if-empty ;
@@ -48,6 +48,6 @@ GENERIC: draw-line ( line index gadget -- )
         [ line-height ]
         [ ]
     } cleave '[
-        0 over _ * 2array
+        0 over _ * >integer 2array
         [ _ draw-line ] with-translation
     ] each-slice-index ;
\ No newline at end of file
index d80992e75101b8002fb6fe66a1bf5ebd37d0d3af..9bfee85d6566f7d5e73e04820be2e533f10e0750 100644 (file)
@@ -3,7 +3,8 @@
 USING: colors.constants kernel locals math.rectangles
 namespaces sequences ui.commands ui.gadgets ui.gadgets.borders
 ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs
-ui.gadgets.worlds ui.gestures ui.operations ;
+ui.gadgets.worlds ui.gestures ui.operations ui.pens.solid
+accessors ;
 IN: ui.gadgets.menus
 
 : show-menu ( owner menu -- )
index d997ae50cac9f603ccbaaf0ae11afbde21646c2a..c588ed1b98005653ecddf71a3893f849efd93f63 100644 (file)
@@ -23,7 +23,7 @@ TUPLE: pack < gadget
     [ { 0 0 } ] dip '[ v+ _ v+ ] accumulate nip ;
 
 : numerically-aligned-locs ( sizes pack -- seq )
-    [ align>> ] [ dim>> ] bi '[ [ _ _ ] dip v- n*v ] map ;
+    [ align>> ] [ dim>> ] bi '[ [ _ _ ] dip v- [ * >integer ] with map ] map ;
 
 : baseline-aligned-locs ( pack -- seq )
     children>> baseline-align [ 0 swap 2array ] map ;
@@ -39,7 +39,7 @@ TUPLE: pack < gadget
 
 : round-dims ( seq -- newseq )
     [ { 0 0 } ] dip
-    [ swap v- dup [ ceiling >fixnum ] map [ swap v- ] keep ] map
+    [ swap v- dup [ ceiling ] map [ swap v- ] keep ] map
     nip ;
 
 PRIVATE>
index 16addef0444f18e49556b2dc45a86c160f2e4182..3842b9959f813259f3a3e98b3149d83f1dc6d5ab 100644 (file)
@@ -3,10 +3,10 @@
 USING: arrays hashtables io kernel namespaces sequences io.styles
 strings quotations math opengl combinators memoize math.vectors
 sorting splitting assocs classes.tuple models continuations
-destructors accessors math.rectangles fry fonts ui.images ui.gadgets
-ui.gadgets.private ui.gadgets.borders ui.gadgets.buttons
-ui.gadgets.labels ui.gadgets.scrollers ui.gadgets.paragraphs
-ui.gadgets.incremental ui.gadgets.packs
+destructors accessors math.rectangles fry fonts ui.pens.solid
+ui.images ui.gadgets ui.gadgets.private ui.gadgets.borders
+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 ;
index 699dfc3b5bd291dc9fc568bae765acdba474df69..edeba07d12de22ce0af06e764fb4a8060a79ddfa 100755 (executable)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: math.rectangles math.vectors namespaces kernel accessors
-combinators sequences opengl opengl.gl opengl.glu colors.constants
-ui.gadgets ui.pens ;
+combinators sequences opengl opengl.gl opengl.glu colors
+colors.constants ui.gadgets ui.pens ;
 IN: ui.render
 
 SYMBOL: clip
index 98d1bae569ad4cd16327102631bdecfb2504dfb4..5f134a930c0efca5f8892250e1be0fecb0d5b197 100644 (file)
@@ -6,12 +6,12 @@ sequences models models.history tools.apropos
 ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
 ui.gadgets.tracks ui.gestures ui.gadgets.buttons ui.gadgets.packs
 ui.gadgets.editors ui.gadgets.labels ui.gadgets.status-bar
-ui.tools.common ui ;
+ui.gadgets.borders ui.tools.common ui ;
 IN: ui.tools.browser
 
 TUPLE: browser-gadget < tool pane scroller search-field ;
 
-{ 550 400 } browser-gadget set-tool-dim
+{ 650 400 } browser-gadget set-tool-dim
 
 : show-help ( link browser-gadget -- )
     model>> dup add-history
@@ -29,17 +29,19 @@ TUPLE: browser-gadget < tool pane scroller search-field ;
         10 >>max-width ;
 
 : <browser-toolbar> ( browser -- toolbar )
-    <shelf>
+    horizontal <track>
+        0 >>fill
         1/2 >>align
         { 5 5 } >>gap
-        over <toolbar> add-gadget
-        swap search-field>> "Search:" label-on-left add-gadget ;
+        over <toolbar> f track-add
+        swap search-field>> "Search:" label-on-left 1 track-add ;
 
 : <browser-gadget> ( link -- gadget )
     vertical browser-gadget new-track
+        1 >>fill
         swap >link <history> >>model
         dup <search-field> >>search-field
-        dup <browser-toolbar> f track-add
+        dup <browser-toolbar> { 3 3 } <border> { 1 0 } >>fill f track-add
         dup <help-pane> >>pane
         dup pane>> <scroller> >>scroller
         dup scroller>> 1 track-add ;