]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.theme.switching: default font colors.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 15 May 2016 17:44:29 +0000 (10:44 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 22 May 2016 14:53:21 +0000 (07:53 -0700)
16 files changed:
basis/fonts/fonts.factor
basis/ui/gadgets/buttons/buttons.factor
basis/ui/gadgets/labeled/labeled.factor
basis/ui/gadgets/labels/labels.factor
basis/ui/gadgets/panes/panes.factor
basis/ui/gadgets/theme/theme.factor
basis/ui/theme/switching/switching.factor
basis/ui/tools/browser/browser.factor
basis/ui/tools/common/common.factor
basis/ui/tools/debugger/debugger.factor
basis/ui/tools/inspector/inspector.factor
basis/ui/tools/listener/completion/completion.factor
basis/ui/tools/listener/listener.factor
basis/ui/tools/traceback/traceback.factor
basis/ui/tools/walker/walker.factor
extra/ui/gadgets/lists/lists.factor

index ab71e2a1a4392ba3676c541e91fca7544e1bbfb3..95cbbadfae56656ad0fbeae8d11999e73e2982e3 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors colors.constants combinators kernel math ;
+USING: accessors colors.constants combinators kernel math
+namespaces ;
 IN: fonts
 
 CONSTANT: default-serif-font-name "serif"
@@ -9,16 +10,18 @@ CONSTANT: default-monospace-font-name "monospace"
 
 CONSTANT: default-font-size 12
 
-TUPLE: font
-name
-size
-bold?
-italic?
-{ foreground initial: COLOR: black }
-{ background initial: COLOR: white } ;
+SYMBOL: default-font-foreground-color
+COLOR: black default-font-foreground-color set-global
+
+SYMBOL: default-font-background-color
+COLOR: white default-font-background-color set-global
+
+TUPLE: font name size bold? italic? foreground background ;
 
 : <font> ( -- font )
-    font new ; inline
+    font new
+        default-font-foreground-color get >>foreground
+        default-font-background-color get >>background ; inline
 
 : font-with-foreground ( font color -- font' )
     [ clone ] dip >>foreground ; inline
index 3fea83065a7a243c02f3dbe290440be6154c4910..74c72747002465c3a66fae05aa1e2d4ed4357ada 100644 (file)
@@ -134,7 +134,7 @@ PRIVATE>
     <button-pen> ;
 
 : border-button-label-theme ( gadget -- )
-    dup label? [ [ clone t >>bold? text-color >>foreground ] change-font ] when drop ;
+    dup label? [ [ clone t >>bold? ] change-font ] when drop ;
 
 : border-button-theme ( gadget -- gadget )
     dup gadget-child border-button-label-theme
index 3c826c9c9d9ca2af727ac47a5d3c74110956918b..f4392b8a783989287dc1c889dcba1b2ff63bf939 100644 (file)
@@ -21,7 +21,7 @@ M: labeled-gadget focusable-child* content>> ;
 
 : add-title-bar ( title track -- track )
     swap >label
-    [ t >>bold? text-color >>foreground ] change-font
+    [ t >>bold? ] change-font
     { 0 4 } <border>
     title-bar-interior >>interior
     f track-add ;
index a4fce2cd57ba57899131af0bbe6ddb10c7cd4f0e..57ea2bb04ef25c485a7a0837a8c9fdb5f0aba30d 100644 (file)
@@ -67,10 +67,10 @@ M: label cap-height*
 <PRIVATE
 
 : label-background ( label -- color )
-    gadget-background background get or ; inline
+    gadget-background [ background get ] unless* ; inline
 
 : label-foreground ( label -- color )
-    gadget-foreground foreground get or ; inline
+    gadget-foreground [ foreground get ] unless* ; inline
 
 PRIVATE>
 
@@ -91,13 +91,6 @@ M: label-control model-changed
     "" label-control new-label
         swap >>model ;
 
-: text-theme ( gadget -- gadget )
-    monospace-font >>font theme-font-colors ;
-
-: reverse-video-theme ( label -- label )
-    sans-serif-font reverse-video-font >>font
-    COLOR: black <solid> >>interior ;
-
 GENERIC: >label ( obj -- gadget )
 M: string >label <label> ;
 M: array >label <label> ;
index 5a706b0c6f663838c0f4cd5a720b402acd0fbb25..20ac7a7415a503ea239ab382f66b955fedd2aa43 100644 (file)
@@ -321,7 +321,7 @@ M: paragraph dispose drop ;
 
 : gadget-write ( string gadget -- )
     swap dup empty?
-    [ 2drop ] [ <label> text-theme add-gadget drop ] if ;
+    [ 2drop ] [ <label> monospace-font >>font add-gadget drop ] if ;
 
 M: pack stream-write gadget-write ;
 
index b250531b5546888193228faf836247cd8b9fed82..ac19fa5225ad359b5c9b306e37273f87fa1ba859 100644 (file)
@@ -3,10 +3,5 @@
 USING: accessors io.pathnames sequences ui.images ui.theme ;
 IN: ui.gadgets.theme
 
-SLOT: font ! Temporarily necessary to fix Windows bootstrap.
-
 : theme-image ( name -- image-name )
     "vocab:ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;
-
-: theme-font-colors ( gadget -- gadget )
-    [ content-background >>background text-color >>foreground ] change-font ;
index 1b5083a000f280b55e60896d6d541a74da51907a..bd866c92cced9a52e69a7baa65bb8abbc775300b 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2016 Nicolas PĂ©net.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs fry hashtables help.stylesheet help.tips io.styles
-kernel listener namespaces prettyprint.stylesheet sequences
-ui.theme ui.tools.listener vocabs.prettyprint words ;
+USING: assocs fonts fry hashtables help.stylesheet help.tips
+io.styles kernel listener namespaces prettyprint.stylesheet
+sequences ui.theme ui.tools.listener vocabs.prettyprint words ;
 IN: ui.theme.switching
 
 <PRIVATE
@@ -11,6 +11,10 @@ IN: ui.theme.switching
     '[ _ _ rot ?set-at ] change-global ;
 
 : update-stylesheet ( -- )
+    ! fonts
+    text-color default-font-foreground-color set-global
+    content-background default-font-background-color set-global
+
     ! help.stylesheet
     default-span-style text-color foreground update-style
     link-style link-color foreground update-style
index c106a22b95a24fad8f469d94e7e15f6573e19e3f..b9988798b2f03d17b05368f477697ff790b120d0 100644 (file)
@@ -101,7 +101,6 @@ CONSTANT: next 1
 
 : <search-field> ( browser -- field )
     '[ _ search-browser ] <action-field>
-        [ theme-font-colors ] change-editor
         "Search" >>default-text
         10 >>min-cols
         10 >>max-cols
index 9c927a0a158838c90190383e3a2bab395edd0853..898e25252d5bd5b69e573a1941a415ea1557d7b8 100644 (file)
@@ -44,7 +44,7 @@ SLOT: scroller
     { 9 9 } <filled-border> ;
 
 : with-lines ( track -- track )
-    dup orientation>> >>gap 
+    dup orientation>> >>gap
     line-color <solid> >>interior ;
 
 : white-interior ( track -- track )
index 0f877dc5b6434a830a0f336241f64b5cd78998e3..3ea4e7e8aeb89dcf4f99b4ff815d83960c6658d7 100644 (file)
@@ -36,7 +36,7 @@ M: restart-renderer row-columns
     [ error>> <error-pane> add-gadget ]
     [
         dup restart-hook>> [
-            [ "To continue, pick one of the options below:" <label> theme-font-colors add-gadget ] dip
+            [ "To continue, pick one of the options below:" <label> add-gadget ] dip
             restart-list>> add-gadget
         ] [ drop ] if
     ] bi ;
@@ -49,7 +49,7 @@ PRIVATE>
         swap >>restarts
         swap >>continuation
         swap >>error
-        dup <restart-list> theme-font-colors >>restart-list
+        dup <restart-list> >>restart-list
         dup <error-display> margins white-interior f track-add
         add-toolbar ;
 
index 209e0624bfe3ada19e29de36942ebdd50a6918a0..9ce14b0e2a932d903eead1e8dc3c1f9ecbbfded4 100644 (file)
@@ -74,7 +74,7 @@ M: hashtable make-slot-descriptions
 : <inspector-table> ( model -- table )
     [ make-slot-descriptions ] <arrow> inspector-renderer <table>
         [ invoke-primary-operation ] >>action
-        monospace-font >>font theme-font-colors
+        monospace-font >>font
         line-color >>column-line-color
         6 >>gap
         15 >>min-rows
index d5f4b321430a4a33bc35dd94045f55d698e89902..435751db2b8bbd22766783ef8feef4af9b41e154 100644 (file)
@@ -141,7 +141,7 @@ GENERIC# accept-completion-hook 1 ( item popup -- )
 : <completion-table> ( interactor completion-mode -- table )
     [ completion-element ] [ completion-quot ] [ nip ] 2tri
     [ <completion-model> ] dip <table>
-        monospace-font >>font theme-font-colors
+        monospace-font >>font
         t >>selection-required?
         t >>single-click?
         30 >>min-cols
index 36322b4fc6c53edd6027a614a10f8bfd314c91be..56a8157b0d7b196f82b8d8ced19b336e12218b25 100644 (file)
@@ -74,7 +74,6 @@ M: color-completion (word-at-caret) 2drop f ;
 
 : <interactor> ( -- gadget )
     interactor new-editor
-        theme-font-colors
         <flag> >>flag
         dup one-word-elt <element-model> >>token-model
         dup <word-model> >>word-model
index d2a839ba737cdb24ca85d78152e9a543ff2ff7c4..18ee54bc87efb4f91896a426bd1bd8d0cfe93056 100644 (file)
@@ -28,7 +28,7 @@ M: stack-entry-renderer row-value drop object>> ;
         10 >>max-rows
         40 >>min-cols
         40 >>max-cols
-        monospace-font >>font theme-font-colors
+        monospace-font >>font
         [ i:inspector ] >>action
         t >>single-click? ;
 
index 9e5fa4f6795e8b24139e44351d9cf4a68d52b972..6de88d52ec6314270dd1601cd4ffd6cfbbeabc47 100644 (file)
@@ -78,9 +78,9 @@ M: thread-status model-changed
 : add-thread-status ( track -- track )
     horizontal <track> { 5 5 } >>gap
         "Thread:" <label>
-            [ t >>bold? text-color >>foreground ] change-font
+            [ t >>bold? ] change-font
             f track-add
-        self name>> <label> [ text-color >>foreground ] change-font f track-add
+        self name>> <label> f track-add
         over status>> <thread-status>
             dup font>> t >>bold? drop
             f track-add
index 1767af35f27dddef4b7f156d6505ba16e81c28f9..e097b2a7bc64b776854a992945b49203d89cba06 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel locals math math.order math.rectangles
-math.vectors models namespaces opengl sequences ui.commands
-ui.gadgets ui.gadgets.labels ui.gadgets.packs
+USING: accessors fonts kernel locals math math.order
+math.rectangles math.vectors models namespaces opengl sequences
+ui.commands ui.gadgets ui.gadgets.labels ui.gadgets.packs
 ui.gadgets.presentations ui.gadgets.scrollers
 ui.gadgets.viewports ui.gestures ui.render ui.theme ;
 IN: ui.gadgets.lists
@@ -32,7 +32,8 @@ TUPLE: list < pack index presenter color hook ;
     hook>> [ [ list? ] find-parent ] prepend ;
 
 : <list-presentation> ( hook elt presenter -- gadget )
-    [ call( elt -- obj ) ] [ drop ] 2bi [ >label text-theme ] dip
+    [ call( elt -- obj ) ] [ drop ] 2bi
+    [ >label monospace-font >>font ] dip
     <presentation>
     swap >>hook ; inline