From c7ca2269b61b9364fdf096f01fdbb58799bf8a4d Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 21 Apr 2016 17:00:06 -0700 Subject: [PATCH] use MAIN-WINDOW: in a few places. --- extra/cairo-demo/cairo-demo.factor | 9 +++------ extra/pong/pong.factor | 8 +++----- .../animate-pendulum/animate-pendulum.factor | 7 +++---- extra/rosetta-code/animation/animation.factor | 7 +++---- extra/rosetta-code/image-noise/image-noise.factor | 7 +++---- extra/rosetta-code/opengl/opengl.factor | 11 +++++------ extra/trails/trails.factor | 8 +++----- 7 files changed, 23 insertions(+), 34 deletions(-) diff --git a/extra/cairo-demo/cairo-demo.factor b/extra/cairo-demo/cairo-demo.factor index b08729b7a1..81b3b6904d 100644 --- a/extra/cairo-demo/cairo-demo.factor +++ b/extra/cairo-demo/cairo-demo.factor @@ -78,9 +78,6 @@ M: cairo-demo-gadget ungraft* ( gadget -- ) : ( -- gadget ) cairo-demo-gadget new ; -: run-cairo-demo ( -- ) - [ - "Hello World from Factor!" open-window - ] with-ui ; - -MAIN: run-cairo-demo +MAIN-WINDOW: run-cairo-demo + { { title "Hello World from Factor!" } } + >>gadgets ; diff --git a/extra/pong/pong.factor b/extra/pong/pong.factor index 4f77e431ff..9939c9fc77 100644 --- a/extra/pong/pong.factor +++ b/extra/pong/pong.factor @@ -165,8 +165,6 @@ M:: draw-gadget* ( PONG -- ) ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: pong-window ( -- ) pong [ "PONG" open-window ] [ start-pong-thread ] bi ; - -: pong-main ( -- ) [ pong-window ] with-ui ; - -MAIN: pong-window +MAIN-WINDOW: pong-window + { { title "PONG" } } + pong [ >>gadgets ] [ start-pong-thread ] bi ; diff --git a/extra/rosetta-code/animate-pendulum/animate-pendulum.factor b/extra/rosetta-code/animate-pendulum/animate-pendulum.factor index 53b94470ee..5743dfcafc 100644 --- a/extra/rosetta-code/animate-pendulum/animate-pendulum.factor +++ b/extra/rosetta-code/animate-pendulum/animate-pendulum.factor @@ -54,7 +54,6 @@ M: pendulum-gadget ungraft* pendulum-gadget new { 500 500 } >>pref-dim ; -: pendulum-main ( -- ) - [ "pendulum" open-window ] with-ui ; - -MAIN: pendulum-main +MAIN-WINDOW: pendulum-main + { { title "pendulum" } } + >>gadgets ; diff --git a/extra/rosetta-code/animation/animation.factor b/extra/rosetta-code/animation/animation.factor index f6e2147872..806d201f86 100644 --- a/extra/rosetta-code/animation/animation.factor +++ b/extra/rosetta-code/animation/animation.factor @@ -46,7 +46,6 @@ M: animated-label graft* M: animated-label ungraft* alarm>> stop-timer ; -: animated-main ( -- ) - [ sentence "Rosetta" open-window ] with-ui ; - -MAIN: animated-main +MAIN-WINDOW: animated-main + { { title "Rosetta" } } + sentence >>gadgets ; diff --git a/extra/rosetta-code/image-noise/image-noise.factor b/extra/rosetta-code/image-noise/image-noise.factor index 72b5166213..cb4fcdf952 100644 --- a/extra/rosetta-code/image-noise/image-noise.factor +++ b/extra/rosetta-code/image-noise/image-noise.factor @@ -67,7 +67,6 @@ M: bw-noise-gadget ungraft* [ stop-animation ] [ call-next-method ] bi ; [ fps-model>> fps-gadget ] [ swap add-gadget swap add-gadget ] bi ; -: open-noise-window ( -- ) - [ with-fps "Black and White noise" open-window ] with-ui ; - -MAIN: open-noise-window +MAIN-WINDOW: open-noise-window + { { title "Black and White noise" } } + >>gadgets ; diff --git a/extra/rosetta-code/opengl/opengl.factor b/extra/rosetta-code/opengl/opengl.factor index aad769a313..498aea074a 100644 --- a/extra/rosetta-code/opengl/opengl.factor +++ b/extra/rosetta-code/opengl/opengl.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2012 Anonymous ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.rectangles opengl.gl sequences ui -ui.gadgets ui.render ; +USING: accessors kernel math math.rectangles opengl.gl +sequences ui ui.gadgets ui.render ; IN: rosetta-code.opengl ! http://rosettacode.org/wiki/OpenGL @@ -35,7 +35,6 @@ M: triangle-gadget pref-dim* drop { 640 480 } ; M: triangle-gadget draw-gadget* rect-bounds nip first2 reshape paint ; -: triangle-window ( -- ) - [ triangle-gadget new "Triangle" open-window ] with-ui ; - -MAIN: triangle-window +MAIN-WINDOW: triangle-window + { { title "Triangle" } } + triangle-gadget new >>gadgets ; diff --git a/extra/trails/trails.factor b/extra/trails/trails.factor index b678899db1..8c39597ee0 100644 --- a/extra/trails/trails.factor +++ b/extra/trails/trails.factor @@ -92,8 +92,6 @@ M:: trails-gadget draw-gadget* ( GADGET -- ) dup start-trails-thread ; -: trails-window ( -- ) [ "Trails" open-window ] with-ui ; - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -MAIN: trails-window +MAIN-WINDOW: trails-window + { { title "Trails" } } + >>gadgets ; -- 2.34.1