From 01401e2becac32ebe6f6e8557105653006bc90ae Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:22:54 -0500 Subject: [PATCH 01/12] ui.gadgets.slate: Restore glOrtho settings such that workspace isn't blurry --- extra/ui/gadgets/slate/slate.factor | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extra/ui/gadgets/slate/slate.factor b/extra/ui/gadgets/slate/slate.factor index 08e8b2765c..0505586b53 100644 --- a/extra/ui/gadgets/slate/slate.factor +++ b/extra/ui/gadgets/slate/slate.factor @@ -96,18 +96,21 @@ M: slate draw-gadget* ( slate -- ) establish-coordinate-system - GL_MODELVIEW glMatrixMode glLoadIdentity glPushMatrix + GL_MODELVIEW glMatrixMode glPushMatrix glLoadIdentity setup-viewport draw-slate - GL_PROJECTION glMatrixMode glPopMatrix - GL_MODELVIEW glMatrixMode glPopMatrix + GL_PROJECTION glMatrixMode glPopMatrix glLoadIdentity + GL_MODELVIEW glMatrixMode glPopMatrix glLoadIdentity dup find-world - default-coordinate-system + ! The world coordinate system is a little wacky: + dup { [ drop 0 ] [ width ] [ height ] [ drop 0 ] } cleave -1 1 glOrtho setup-viewport drop - drop ; \ No newline at end of file + drop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From bf2a1d2399ee9e694e49b9739746871f11c7bbfc Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:24:00 -0500 Subject: [PATCH 02/12] golden-section: word --- extra/golden-section/golden-section.factor | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/extra/golden-section/golden-section.factor b/extra/golden-section/golden-section.factor index 05e7f68d0a..8d1e6b49d6 100644 --- a/extra/golden-section/golden-section.factor +++ b/extra/golden-section/golden-section.factor @@ -39,16 +39,15 @@ IN: golden-section ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +: ( -- gadget ) + + { 600 600 } >>pdim + { -400 400 } x-range + { -400 400 } y-range + [ golden-section ] >>action ; + : golden-section-window ( -- ) - [ - - { 600 600 } >>pdim - { -400 400 } x-range - { -400 400 } y-range - [ golden-section ] >>action - "Golden Section" open-window - ] - with-ui ; + [ "Golden Section" open-window ] with-ui ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From 011a63a27ee9d76e558c1d0215ad8888b7a72d2c Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:29:48 -0500 Subject: [PATCH 03/12] prettyprint.backend: Use color objects --- basis/prettyprint/backend/backend.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/prettyprint/backend/backend.factor b/basis/prettyprint/backend/backend.factor index 00b38ae4f8..111bcfdafc 100755 --- a/basis/prettyprint/backend/backend.factor +++ b/basis/prettyprint/backend/backend.factor @@ -5,7 +5,7 @@ hashtables io assocs kernel math namespaces sequences strings sbufs io.styles vectors words prettyprint.config prettyprint.sections quotations io io.files math.parser effects classes.tuple math.order classes.tuple.private classes -combinators ; +combinators colors ; IN: prettyprint.backend GENERIC: pprint* ( obj -- ) @@ -89,7 +89,7 @@ M: f pprint* drop \ f pprint-word ; : string-style ( obj -- hash ) [ presented set - { 0.3 0.3 0.3 1.0 } foreground set + T{ rgba f 0.3 0.3 0.3 1.0 } foreground set ] H{ } make-assoc ; : unparse-string ( str prefix suffix -- str ) From 4deed7b44a6757cc7ae677ce6dae56048f98bf97 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:32:47 -0500 Subject: [PATCH 04/12] help.stylesheet: Use color objects --- basis/help/stylesheet/stylesheet.factor | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/basis/help/stylesheet/stylesheet.factor b/basis/help/stylesheet/stylesheet.factor index 68810e2369..50357db8cf 100755 --- a/basis/help/stylesheet/stylesheet.factor +++ b/basis/help/stylesheet/stylesheet.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io.styles namespaces ; +USING: io.styles namespaces colors ; IN: help.stylesheet SYMBOL: default-span-style @@ -17,7 +17,7 @@ H{ SYMBOL: link-style H{ - { foreground { 0 0 0.3 1 } } + { foreground T{ rgba f 0 0 0.3 1 } } { font-style bold } } link-style set-global @@ -33,7 +33,7 @@ H{ { font-size 18 } { font-style bold } { wrap-margin 500 } - { page-color { 0.8 0.8 0.8 1 } } + { page-color T{ rgba f 0.8 0.8 0.8 1 } } { border-width 5 } } title-style set-global @@ -58,12 +58,12 @@ SYMBOL: snippet-style H{ { font "monospace" } { font-size 12 } - { foreground { 0.1 0.1 0.4 1 } } + { foreground T{ rgba f 0.1 0.1 0.4 1 } } } snippet-style set-global SYMBOL: code-style H{ - { page-color { 0.8 0.8 0.8 0.5 } } + { page-color T{ rgba f 0.8 0.8 0.8 0.5 } } { border-width 5 } { wrap-margin f } } code-style set-global @@ -74,13 +74,13 @@ H{ { font-style bold } } input-style set-global SYMBOL: url-style H{ { font "monospace" } - { foreground { 0.0 0.0 1.0 1.0 } } + { foreground T{ rgba f 0.0 0.0 1.0 1.0 } } } url-style set-global SYMBOL: warning-style H{ - { page-color { 0.95 0.95 0.95 1 } } - { border-color { 1 0 0 1 } } + { page-color T{ rgba f 0.95 0.95 0.95 1 } } + { border-color T{ rgba f 1 0 0 1 } } { border-width 5 } { wrap-margin 500 } } warning-style set-global @@ -93,7 +93,7 @@ H{ SYMBOL: table-style H{ { table-gap { 5 5 } } - { table-border { 0.8 0.8 0.8 1.0 } } + { table-border T{ rgba f 0.8 0.8 0.8 1.0 } } } table-style set-global SYMBOL: list-style From 694de3fb70b9259f0b3d534fd098118f07a6defa Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:33:20 -0500 Subject: [PATCH 05/12] listener: Use color objects --- basis/listener/listener.factor | 5 +++-- extra/colors/colors.factor | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/basis/listener/listener.factor b/basis/listener/listener.factor index 5ff5830e7a..feddbdc042 100755 --- a/basis/listener/listener.factor +++ b/basis/listener/listener.factor @@ -3,7 +3,8 @@ USING: arrays hashtables io kernel math math.parser memory namespaces parser lexer sequences strings io.styles vectors words generic system combinators continuations debugger -definitions compiler.units accessors ; +definitions compiler.units accessors colors ; + IN: listener SYMBOL: quit-flag @@ -41,7 +42,7 @@ M: object stream-read-quot : prompt. ( -- ) "( " in get " )" 3append - H{ { background { 1 0.7 0.7 1 } } } format bl flush ; + H{ { background T{ rgba f 1 0.7 0.7 1 } } } format bl flush ; SYMBOL: error-hook diff --git a/extra/colors/colors.factor b/extra/colors/colors.factor index ae3695cf8b..f88fe6eb05 100644 --- a/extra/colors/colors.factor +++ b/extra/colors/colors.factor @@ -27,7 +27,7 @@ M: hsva >rgba ( hsva -- rgba ) M: gray >rgba ( gray -- rgba ) [ gray>> dup dup ] [ alpha>> ] bi rgba boa ; -M: array >rgba ( array -- rgba ) first4 rgba boa ; +! M: array >rgba ( array -- rgba ) first4 rgba boa ; M: color red>> ( color -- red ) >rgba red>> ; M: color green>> ( color -- green ) >rgba green>> ; From f33039f2d1a94e1b535b6a81c37418ef7fc1fad2 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:34:19 -0500 Subject: [PATCH 06/12] colors: Remove the '>rgba' method on array (was a kludge). --- extra/colors/colors.factor | 2 -- 1 file changed, 2 deletions(-) diff --git a/extra/colors/colors.factor b/extra/colors/colors.factor index f88fe6eb05..77a1f46c87 100644 --- a/extra/colors/colors.factor +++ b/extra/colors/colors.factor @@ -27,8 +27,6 @@ M: hsva >rgba ( hsva -- rgba ) M: gray >rgba ( gray -- rgba ) [ gray>> dup dup ] [ alpha>> ] bi rgba boa ; -! M: array >rgba ( array -- rgba ) first4 rgba boa ; - M: color red>> ( color -- red ) >rgba red>> ; M: color green>> ( color -- green ) >rgba green>> ; M: color blue>> ( color -- blue ) >rgba blue>> ; From 2401301927df4b8ec992c731debe407e0a33a712 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 14:59:53 -0500 Subject: [PATCH 07/12] Remove 'processing.color' (evolved into colors) --- extra/processing/color/color.factor | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 extra/processing/color/color.factor diff --git a/extra/processing/color/color.factor b/extra/processing/color/color.factor deleted file mode 100644 index 50d20fcf52..0000000000 --- a/extra/processing/color/color.factor +++ /dev/null @@ -1,22 +0,0 @@ - -USING: kernel sequences ; - -IN: processing.color - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -TUPLE: rgba red green blue alpha ; - -C: rgba - -: ( r g b -- rgba ) 1 ; - -: ( gray -- rgba ) dup dup 1 ; - -: {rgb} ( seq -- rgba ) first3 ; - -! : hex>rgba ( hex -- rgba ) - -! : set-gl-color ( color -- ) -! { [ red>> ] [ green>> ] [ blue>> ] [ alpha>> ] } cleave glColor4d ; - From 7e7653eaff84b3985006602a54a3f0430935a6dc Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 15:11:42 -0500 Subject: [PATCH 08/12] io.styles: Use color objects --- basis/io/styles/styles.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/io/styles/styles.factor b/basis/io/styles/styles.factor index 14827dc7a6..4f0b3ce7e1 100644 --- a/basis/io/styles/styles.factor +++ b/basis/io/styles/styles.factor @@ -33,7 +33,7 @@ SYMBOL: table-border : standard-table-style ( -- style ) H{ { table-gap { 5 5 } } - { table-border { 0.8 0.8 0.8 1.0 } } + { table-border T{ rgba f 0.8 0.8 0.8 1.0 } } } ; ! Input history From 4417a647130c419e121e5d9aee2ed61ac1d13ef1 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 15:12:03 -0500 Subject: [PATCH 09/12] io.styles: Minor tweak --- basis/io/styles/styles.factor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/basis/io/styles/styles.factor b/basis/io/styles/styles.factor index 4f0b3ce7e1..752f413458 100644 --- a/basis/io/styles/styles.factor +++ b/basis/io/styles/styles.factor @@ -1,6 +1,8 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: hashtables io ; + +USING: hashtables io colors ; + IN: io.styles SYMBOL: plain From 0763124bb948af01280bd094da9e1dc81b153506 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 15:47:35 -0500 Subject: [PATCH 10/12] cfdg: Use color objects and 'self.slots' --- extra/cfdg/cfdg.factor | 74 ++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 49 deletions(-) diff --git a/extra/cfdg/cfdg.factor b/extra/cfdg/cfdg.factor index 2dfa7fae8f..d821b7c180 100644 --- a/extra/cfdg/cfdg.factor +++ b/extra/cfdg/cfdg.factor @@ -3,40 +3,16 @@ USING: kernel alien.c-types combinators namespaces arrays sequences sequences.lib namespaces.lib splitting math math.functions math.vectors math.trig opengl.gl opengl.glu opengl ui ui.gadgets.slate - vars - random-weighted colors.hsv cfdg.gl ; + vars colors self self.slots + random-weighted colors.hsv cfdg.gl accessors ; IN: cfdg ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! hsba { hue saturation brightness alpha } +SELF-SLOTS: hsva -: 4array ; - -VAR: color - -! ( -- val ) - -: hue>> 0 color> nth ; -: saturation>> 1 color> nth ; -: brightness>> 2 color> nth ; -: alpha>> 3 color> nth ; - -! ( val -- ) - -: >>hue 0 color> set-nth ; -: >>saturation 1 color> set-nth ; -: >>brightness 2 color> set-nth ; -: >>alpha 3 color> set-nth ; - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -: hsva>rgba ( hsva -- rgba ) [ 3 head hsv>rgb ] [ peek ] bi suffix ; - -: gl-set-hsba ( hsva -- ) hsva>rgba gl-color ; - -: gl-clear-hsba ( hsva -- ) hsva>rgba gl-clear ; +: clear-color ( color -- ) set-clear-color GL_COLOR_BUFFER_BIT glClear ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -50,18 +26,18 @@ VAR: color ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: hue ( num -- ) hue>> + 360 mod >>hue ; +: hue ( num -- ) hue-> + 360 mod ->hue ; -: saturation ( num -- ) saturation>> swap adjust >>saturation ; -: brightness ( num -- ) brightness>> swap adjust >>brightness ; -: alpha ( num -- ) alpha>> swap adjust >>alpha ; +: saturation ( num -- ) saturation-> swap adjust ->saturation ; +: brightness ( num -- ) value-> swap adjust ->value ; +: alpha ( num -- ) alpha-> swap adjust ->alpha ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: h hue ; -: sat saturation ; -: b brightness ; -: a alpha ; +: h ( num -- ) hue ; +: sat ( num -- ) saturation ; +: b ( num -- ) brightness ; +: a ( num -- ) alpha ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -69,9 +45,9 @@ VAR: color-stack : init-color-stack ( -- ) V{ } clone >color-stack ; -: push-color ( -- ) color> color-stack> push color> clone >color ; +: push-color ( -- ) self> color-stack> push self> clone >self ; -: pop-color ( -- ) color-stack> pop dup >color gl-set-hsba ; +: pop-color ( -- ) color-stack> pop dup >self set-color ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -102,11 +78,11 @@ VAR: threshold ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : circle ( -- ) - color> gl-set-hsba + self> set-color gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ; : triangle ( -- ) - color> gl-set-hsba + self> set-color GL_POLYGON glBegin 0 0.577 glVertex2d 0.5 -0.289 glVertex2d @@ -114,7 +90,7 @@ VAR: threshold glEnd ; : square ( -- ) - color> gl-set-hsba + self> set-color GL_POLYGON glBegin -0.5 0.5 glVertex2d 0.5 0.5 glVertex2d @@ -138,10 +114,10 @@ VAR: threshold ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: s size ; -: s* size* ; -: r rotate ; -: f flip ; +: s ( scale -- ) size ; +: s* ( scale-x scale-y -- ) size* ; +: r ( angle -- ) rotate ; +: f ( angle -- ) flip ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -162,12 +138,12 @@ VAR: threshold VAR: background -: set-initial-background ( -- ) { 0 0 1 1 } clone >color ; +: set-initial-background ( -- ) T{ hsva f 0 0 1 1 } clone >self ; : set-background ( -- ) set-initial-background background> call - color> gl-clear-hsba ; + self> clear-color ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -177,7 +153,7 @@ VAR: viewport ! { left width bottom height } VAR: start-shape -: set-initial-color ( -- ) { 0 0 0 1 } clone >color ; +: set-initial-color ( -- ) T{ hsva f 0 0 0 1 } clone >self ; : display ( -- ) @@ -198,7 +174,7 @@ VAR: start-shape set-initial-color - color> gl-set-hsba + self> set-color start-shape> call ; From 438fd22bd36a4170ab03a0c9e3af8916d2e29cb6 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 17:15:44 -0500 Subject: [PATCH 11/12] color-picker: Use color objects --- extra/color-picker/color-picker.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/color-picker/color-picker.factor b/extra/color-picker/color-picker.factor index c3214f5bf2..5400a12f89 100755 --- a/extra/color-picker/color-picker.factor +++ b/extra/color-picker/color-picker.factor @@ -4,7 +4,7 @@ USING: kernel math math.functions math.parser models models.filter models.range models.compose sequences ui ui.gadgets ui.gadgets.frames ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders ui.render math.geometry.rect accessors - ui.gadgets.grids ; + ui.gadgets.grids colors ; IN: color-picker ! Simple example demonstrating the use of models. @@ -23,7 +23,7 @@ M: color-preview model-changed swap model-value over set-gadget-interior relayout-1 ; : ( model -- model ) - [ [ 256 /f ] map 1 suffix ] ; + [ [ 256 /f ] map 1 suffix first4 rgba boa ] ; : ( -- model gadget ) 3 [ 0 0 0 255 ] replicate From 3073ab62d6284539ae2fba1ee782236a3d9bfd35 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 1 Aug 2008 17:16:50 -0500 Subject: [PATCH 12/12] automata: Edit tags --- extra/automata/ui/tags.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 extra/automata/ui/tags.txt diff --git a/extra/automata/ui/tags.txt b/extra/automata/ui/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/automata/ui/tags.txt @@ -0,0 +1 @@ +demos