refactoring

cvs
Slava Pestov 2005-05-03 23:10:20 +00:00
parent 6f1abd0980
commit 61d6967ebe
4 changed files with 31 additions and 26 deletions

View File

@ -126,6 +126,7 @@ t [
"/library/ui/inspector.factor"
"/library/ui/init-world.factor"
"/library/ui/tool-menus.factor"
"/library/ui/ui.factor"
] pull-in
compile? [

View File

@ -90,7 +90,7 @@ M: editor user-input* ( ch editor -- ? )
scroll>bottom t ;
M: editor pref-size ( editor -- w h )
editor-text shape-size >r 10 + r> ;
editor-text shape-size >r 1 + r> ;
M: editor layout* ( editor -- )
dup editor-caret over caret-size rot resize-gadget

29
library/ui/ui.factor Normal file
View File

@ -0,0 +1,29 @@
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: gadgets
USING: kernel namespaces sdl sequences ;
: title ( -- str )
"Factor " version append ;
SYMBOL: first-time?
global [ first-time? on ] bind
: first-time ( -- )
first-time? get [
world get gadget-paint [ console ] bind
global [ first-time? off ] bind
] when ;
IN: shells
: ui ( -- )
#! Start the Factor graphics subsystem with the given screen
#! dimensions.
t world get set-world-running?
world get shape-w world get shape-h 0 SDL_RESIZABLE
[
0 x set 0 y set [
title dup SDL_WM_SetCaption first-time run-world
] with-screen
] with-scope ;

View File

@ -57,28 +57,3 @@ DEFER: handle-event
world get dup [ world-running? ] when [
"UI not running." throw
] unless ;
: title ( -- str )
"Factor " version append ;
IN: shells
SYMBOL: first-time?
global [ first-time? on ] bind
: first-time ( -- )
first-time? get [
world get gadget-paint [ console ] bind
global [ first-time? off ] bind
] when ;
: ui ( -- )
#! Start the Factor graphics subsystem with the given screen
#! dimensions.
t world get set-world-running?
world get shape-w world get shape-h 0 SDL_RESIZABLE
[
0 x set 0 y set [
title dup SDL_WM_SetCaption first-time run-world
] with-screen
] with-scope ;