Multi-window code cleanups
parent
38602d63b9
commit
3f77d6eb65
|
@ -171,7 +171,7 @@ IN: gadgets
|
||||||
: redraw-world ( handle -- )
|
: redraw-world ( handle -- )
|
||||||
world-handle 1 [setNeedsDisplay:] ;
|
world-handle 1 [setNeedsDisplay:] ;
|
||||||
|
|
||||||
: in-window ( world title -- )
|
: open-window* ( world title -- )
|
||||||
>r <FactorView> r> <ViewWindow> [contentView] [release] ;
|
>r <FactorView> r> <ViewWindow> [contentView] [release] ;
|
||||||
|
|
||||||
: select-gl-context ( handle -- )
|
: select-gl-context ( handle -- )
|
||||||
|
|
|
@ -8,14 +8,14 @@ H{ } clone components set-global
|
||||||
|
|
||||||
: get-components ( class -- assoc )
|
: get-components ( class -- assoc )
|
||||||
components get-global hash [ { } ] unless*
|
components get-global hash [ { } ] unless*
|
||||||
{ "Slots" [ describe ] } append ;
|
{ "Slots" [ describe ] } add ;
|
||||||
|
|
||||||
{
|
{
|
||||||
{ "Definition" [ help ] }
|
{ "Definition" [ help ] }
|
||||||
{ "Calls in" [ usage. ] }
|
{ "Calls in" [ usage. ] }
|
||||||
{ "Calls out" [ uses. ] }
|
{ "Calls out" [ uses. ] }
|
||||||
} word components get-global set-hash
|
} \ word components get-global set-hash
|
||||||
|
|
||||||
{
|
{
|
||||||
{ "Documentation" [ help ] }
|
{ "Documentation" [ help ] }
|
||||||
} link components get-global set-hash
|
} \ link components get-global set-hash
|
||||||
|
|
|
@ -5,7 +5,7 @@ DEFER: draw-world ! defined in world.factor
|
||||||
|
|
||||||
: redraw-world ( world -- ) draw-world ;
|
: redraw-world ( world -- ) draw-world ;
|
||||||
|
|
||||||
DEFER: in-window ( world title -- )
|
DEFER: open-window* ( world title -- )
|
||||||
|
|
||||||
DEFER: select-gl-context ( handle -- )
|
DEFER: select-gl-context ( handle -- )
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
IN: gadgets-browser
|
IN: gadgets-browser
|
||||||
USING: arrays components gadgets gadgets-buttons gadgets-labels
|
USING: arrays components gadgets gadgets-buttons gadgets-labels
|
||||||
gadgets-layouts gadgets-panes gadgets-scrolling gadgets-theme
|
gadgets-layouts gadgets-panes gadgets-scrolling gadgets-theme
|
||||||
hashtables help inspector kernel lists math namespaces
|
generic hashtables help inspector kernel lists math namespaces
|
||||||
prettyprint sequences words ;
|
prettyprint sequences words ;
|
||||||
|
|
||||||
TUPLE: book page pages ;
|
TUPLE: book page pages ;
|
||||||
|
@ -17,8 +17,7 @@ TUPLE: book page pages ;
|
||||||
C: book ( pages -- book )
|
C: book ( pages -- book )
|
||||||
dup delegate>gadget
|
dup delegate>gadget
|
||||||
[ set-book-pages ] 2keep
|
[ set-book-pages ] 2keep
|
||||||
[ >r first r> show-page ] keep
|
[ >r first first r> show-page ] keep ;
|
||||||
[ show-page ] keep ;
|
|
||||||
|
|
||||||
M: book pref-dim* ( book -- dim )
|
M: book pref-dim* ( book -- dim )
|
||||||
book-pages { 0 0 0 } [ second pref-dim vmax ] reduce ;
|
book-pages { 0 0 0 } [ second pref-dim vmax ] reduce ;
|
||||||
|
@ -27,7 +26,7 @@ M: book layout* ( book -- )
|
||||||
dup rect-dim swap book-page set-gadget-dim ;
|
dup rect-dim swap book-page set-gadget-dim ;
|
||||||
|
|
||||||
: component-pages ( obj -- assoc )
|
: component-pages ( obj -- assoc )
|
||||||
dup get-components
|
dup class get-components
|
||||||
[ first2 swapd make-pane <scroller> 2array ] map-with ;
|
[ first2 swapd make-pane <scroller> 2array ] map-with ;
|
||||||
|
|
||||||
: <tab> ( name book -- button )
|
: <tab> ( name book -- button )
|
||||||
|
@ -65,8 +64,7 @@ C: browser ( obj -- browser )
|
||||||
|
|
||||||
TUPLE: browser-button object ;
|
TUPLE: browser-button object ;
|
||||||
|
|
||||||
: browser-window ( obj -- )
|
: browser-window ( obj -- ) <browser> "Browser" open-window ;
|
||||||
<browser> "Browser" simple-window ;
|
|
||||||
|
|
||||||
: browser-button-action ( button -- )
|
: browser-button-action ( button -- )
|
||||||
[ browser-button-object ] keep find-browser
|
[ browser-button-object ] keep find-browser
|
||||||
|
|
|
@ -35,5 +35,5 @@ hashtables kernel math namespaces queues sequences threads ;
|
||||||
|
|
||||||
: <status-bar> ( -- gadget ) "" <label> dup highlight-theme ;
|
: <status-bar> ( -- gadget ) "" <label> dup highlight-theme ;
|
||||||
|
|
||||||
: simple-window ( gadget title -- )
|
: open-window ( gadget title -- )
|
||||||
>r <status-bar> <world> dup prefer r> in-window ;
|
>r <status-bar> <world> dup prefer r> open-window* ;
|
||||||
|
|
|
@ -91,7 +91,7 @@ M: gadget focusable-child* drop t ;
|
||||||
|
|
||||||
: focusable-child ( gadget -- gadget )
|
: focusable-child ( gadget -- gadget )
|
||||||
dup focusable-child*
|
dup focusable-child*
|
||||||
dup t = [ drop ] [ nip focusable-child ] if ;
|
dup t eq? [ drop ] [ nip focusable-child ] if ;
|
||||||
|
|
||||||
IN: gadgets-layouts
|
IN: gadgets-layouts
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespaces sequences ;
|
||||||
make-pile 1 over set-pack-fill { 5 5 0 } over set-pack-gap
|
make-pile 1 over set-pack-fill { 5 5 0 } over set-pack-gap
|
||||||
<default-border> dup highlight-theme ;
|
<default-border> dup highlight-theme ;
|
||||||
|
|
||||||
: scratch-window ( quot -- )
|
: pane-window ( quot title -- )
|
||||||
make-pane <scroller> "Scratch" simple-window ;
|
>r make-pane <scroller> r> open-window ;
|
||||||
|
|
||||||
: handbook-window ( -- )
|
: handbook-window ( -- )
|
||||||
T{ link f "handbook" } browser-window ;
|
T{ link f "handbook" } browser-window ;
|
||||||
|
@ -23,12 +23,12 @@ namespaces sequences ;
|
||||||
{ "Listener" [ listener-window ] }
|
{ "Listener" [ listener-window ] }
|
||||||
{ "Documentation" [ handbook-window ] }
|
{ "Documentation" [ handbook-window ] }
|
||||||
{ "Tutorial" [ tutorial-window ] }
|
{ "Tutorial" [ tutorial-window ] }
|
||||||
{ "Vocabularies" [ [ vocabs. ] scratch-window ] }
|
{ "Vocabularies" [ [ vocabs. ] "Vocabularies" pane-window ] }
|
||||||
{ "Globals" [ global browser-window ] }
|
{ "Globals" [ global browser-window ] }
|
||||||
{ "Memory" [ [ heap-stats. terpri room. ] scratch-window ] }
|
{ "Memory" [ [ heap-stats. terpri room. ] "Memory" pane-window ] }
|
||||||
{ "Save image" [ save ] }
|
{ "Save image" [ save ] }
|
||||||
{ "Exit" [ 0 exit ] }
|
{ "Exit" [ 0 exit ] }
|
||||||
} <launchpad> ;
|
} <launchpad> ;
|
||||||
|
|
||||||
: launchpad-window ( -- )
|
: launchpad-window ( -- )
|
||||||
default-launchpad "Factor" simple-window ;
|
default-launchpad "Factor" open-window ;
|
||||||
|
|
|
@ -53,5 +53,8 @@ C: listener-gadget ( -- gadget )
|
||||||
|
|
||||||
M: listener-gadget pref-dim* drop { 600 600 0 } ;
|
M: listener-gadget pref-dim* drop { 600 600 0 } ;
|
||||||
|
|
||||||
|
M: listener-gadget focusable-child* ( listener -- gadget )
|
||||||
|
listener-gadget-pane ;
|
||||||
|
|
||||||
: listener-window ( -- )
|
: listener-window ( -- )
|
||||||
<listener-gadget> "Listener" simple-window ;
|
<listener-gadget> "Listener" simple-window ;
|
||||||
|
|
|
@ -27,7 +27,8 @@ C: world ( gadget status -- world )
|
||||||
t over set-gadget-root?
|
t over set-gadget-root?
|
||||||
H{ } clone over set-world-fonts
|
H{ } clone over set-world-fonts
|
||||||
[ add-status ] keep
|
[ add-status ] keep
|
||||||
[ @center frame-add ] keep ;
|
[ @center frame-add ] 2keep
|
||||||
|
swap request-focus ;
|
||||||
|
|
||||||
GENERIC: find-world ( gadget -- world )
|
GENERIC: find-world ( gadget -- world )
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ M: world client-event ( event world -- )
|
||||||
|
|
||||||
IN: gadgets
|
IN: gadgets
|
||||||
|
|
||||||
: in-window ( world title -- ) swap gadget-window set-title ;
|
: open-window* ( world title -- ) swap gadget-window set-title ;
|
||||||
|
|
||||||
: select-gl-context ( handle -- )
|
: select-gl-context ( handle -- )
|
||||||
dpy get swap first2 glXMakeCurrent
|
dpy get swap first2 glXMakeCurrent
|
||||||
|
|
Loading…
Reference in New Issue