Update lot's of ui vocabularies for color objects

db4
Eduardo Cavazos 2008-07-28 17:01:24 -05:00
parent 4643501ba6
commit 20ee2dd2a7
9 changed files with 37 additions and 36 deletions

View File

@ -106,7 +106,7 @@ TUPLE: checkmark-paint color ;
C: <checkmark-paint> checkmark-paint
M: checkmark-paint draw-interior
checkmark-paint-color gl-color
checkmark-paint-color set-color
origin get [
rect-dim
{ 0 0 } over gl-line
@ -152,11 +152,11 @@ TUPLE: radio-paint color ;
C: <radio-paint> radio-paint
M: radio-paint draw-interior
radio-paint-color gl-color
radio-paint-color set-color
origin get { 4 4 } v+ swap rect-dim { 8 8 } v- 12 gl-fill-circle ;
M: radio-paint draw-boundary
radio-paint-color gl-color
radio-paint-color set-color
origin get { 1 1 } v+ swap rect-dim { 2 2 } v- 12 gl-circle ;
: radio-knob-theme ( gadget -- )

View File

@ -129,7 +129,7 @@ M: editor ungraft*
: draw-caret ( -- )
editor get editor-focused? [
editor get
dup editor-caret-color gl-color
dup editor-caret-color set-color
dup caret-loc origin get v+
swap caret-dim over v+
[ { 0.5 -0.5 } v+ ] bi@ gl-line
@ -173,7 +173,7 @@ M: editor ungraft*
: draw-lines ( -- )
\ first-visible-line get [
editor get dup editor-color gl-color
editor get dup editor-color set-color
dup visible-lines
[ draw-line 1 translate-lines ] with each
] with-editor-translation ;
@ -192,7 +192,7 @@ M: editor ungraft*
(draw-selection) ;
: draw-selection ( -- )
editor get editor-selection-color gl-color
editor get editor-selection-color set-color
editor get selection-start/end
over first [
2dup [

View File

@ -25,7 +25,7 @@ SYMBOL: grid-dim
M: grid-lines draw-boundary
origin get [
-0.5 -0.5 0.0 glTranslated
grid-lines-color gl-color [
grid-lines-color set-color [
dup grid set
dup rect-dim half-gap v- grid-dim set
compute-grid

View File

@ -31,8 +31,8 @@ M: labelled-gadget focusable-child* labelled-gadget-content ;
: title-theme ( gadget -- )
{ 1 0 } over set-gadget-orientation
T{ gradient f {
{ 0.65 0.65 1.0 1.0 }
{ 0.65 0.45 1.0 1.0 }
T{ rgba f 0.65 0.65 1.0 1.0 }
T{ rgba f 0.65 0.45 1.0 1.0 }
} } swap set-gadget-interior ;
: <title-label> ( text -- label ) <label> dup title-theme ;

View File

@ -35,7 +35,7 @@ M: label pref-dim*
[ font>> open-font ] [ text>> ] bi text-dim ;
M: label draw-gadget*
[ color>> gl-color ]
[ color>> set-color ]
[ [ font>> ] [ text>> ] bi origin get draw-text ] bi ;
M: label gadget-text* label-string % ;

View File

@ -4,13 +4,14 @@ USING: accessors ui.commands ui.gestures ui.render ui.gadgets
ui.gadgets.labels ui.gadgets.scrollers
kernel sequences models opengl math math.order namespaces
ui.gadgets.presentations ui.gadgets.viewports ui.gadgets.packs
math.vectors classes.tuple math.geometry.rect ;
math.vectors classes.tuple math.geometry.rect colors ;
IN: ui.gadgets.lists
TUPLE: list < pack index presenter color hook ;
: list-theme ( list -- list )
{ 0.8 0.8 1.0 1.0 } >>color ; inline
T{ rgba f 0.8 0.8 1.0 1.0 } >>color ; inline
: <list> ( hook presenter model -- gadget )
list new-gadget
@ -56,7 +57,7 @@ M: list model-changed
M: list draw-gadget*
origin get [
dup list-color gl-color
dup list-color set-color
selected-rect [ rect-extent gl-fill-rect ] when*
] with-translation ;

View File

@ -68,7 +68,7 @@ M: node draw-selection ( loc node -- )
M: pane draw-gadget*
dup gadget-selection? [
dup pane-selection-color gl-color
dup pane-selection-color set-color
origin get over rect-loc v- swap selected-children
[ draw-selection ] with each
] [

View File

@ -18,41 +18,41 @@ IN: ui.gadgets.theme
: plain-gradient
T{ gradient f {
{ 0.94 0.94 0.94 1.0 }
{ 0.83 0.83 0.83 1.0 }
{ 0.83 0.83 0.83 1.0 }
{ 0.62 0.62 0.62 1.0 }
T{ rgba f 0.94 0.94 0.94 1.0 }
T{ rgba f 0.83 0.83 0.83 1.0 }
T{ rgba f 0.83 0.83 0.83 1.0 }
T{ rgba f 0.62 0.62 0.62 1.0 }
} } ;
: rollover-gradient
T{ gradient f {
{ 1.0 1.0 1.0 1.0 }
{ 0.9 0.9 0.9 1.0 }
{ 0.9 0.9 0.9 1.0 }
{ 0.75 0.75 0.75 1.0 }
T{ rgba f 1.0 1.0 1.0 1.0 }
T{ rgba f 0.9 0.9 0.9 1.0 }
T{ rgba f 0.9 0.9 0.9 1.0 }
T{ rgba f 0.75 0.75 0.75 1.0 }
} } ;
: pressed-gradient
T{ gradient f {
{ 0.75 0.75 0.75 1.0 }
{ 0.9 0.9 0.9 1.0 }
{ 0.9 0.9 0.9 1.0 }
{ 1.0 1.0 1.0 1.0 }
T{ rgba f 0.75 0.75 0.75 1.0 }
T{ rgba f 0.9 0.9 0.9 1.0 }
T{ rgba f 0.9 0.9 0.9 1.0 }
T{ rgba f 1.0 1.0 1.0 1.0 }
} } ;
: selected-gradient
T{ gradient f {
{ 0.65 0.65 0.65 1.0 }
{ 0.8 0.8 0.8 1.0 }
{ 0.8 0.8 0.8 1.0 }
{ 1.0 1.0 1.0 1.0 }
T{ rgba f 0.65 0.65 0.65 1.0 }
T{ rgba f 0.8 0.8 0.8 1.0 }
T{ rgba f 0.8 0.8 0.8 1.0 }
T{ rgba f 1.0 1.0 1.0 1.0 }
} } ;
: lowered-gradient
T{ gradient f {
{ 0.37 0.37 0.37 1.0 }
{ 0.43 0.43 0.43 1.0 }
{ 0.5 0.5 0.5 1.0 }
T{ rgba f 0.37 0.37 0.37 1.0 }
T{ rgba f 0.43 0.43 0.43 1.0 }
T{ rgba f 0.5 0.5 0.5 1.0 }
} } ;
: sans-serif-font { "sans-serif" plain 12 } ;

View File

@ -35,7 +35,7 @@ SYMBOL: viewport-translation
init-clip
! white gl-clear is broken w.r.t window resizing
! Linux/PPC Radeon 9200
white gl-color
white set-color
clip get rect-extent gl-fill-rect ;
GENERIC: draw-gadget* ( gadget -- )
@ -95,7 +95,7 @@ C: <solid> solid
! Solid pen
: (solid) ( gadget paint -- loc dim )
solid-color gl-color rect-dim >r origin get dup r> v+ ;
solid-color set-color rect-dim >r origin get dup r> v+ ;
M: solid draw-interior (solid) gl-fill-rect ;
@ -121,7 +121,7 @@ C: <polygon> polygon
: draw-polygon ( polygon quot -- )
origin get [
>r dup polygon-color gl-color polygon-points r> call
>r dup polygon-color set-color polygon-points r> call
] with-translation ; inline
M: polygon draw-boundary