factor/basis/ui/tools/profiler/profiler.factor

52 lines
1.4 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: ui.tools.workspace kernel quotations tools.profiler
ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
ui.gadgets.tracks ui.gestures ui.gadgets.buttons accessors fry ;
2007-09-20 18:09:08 -04:00
IN: ui.tools.profiler
TUPLE: profiler-gadget < track pane ;
2007-09-20 18:09:08 -04:00
: <profiler-gadget> ( -- gadget )
{ 0 1 } profiler-gadget new-track
2008-11-20 22:58:30 -05:00
add-toolbar
<pane> >>pane
dup pane>> <scroller> 1 track-add ;
2007-09-20 18:09:08 -04:00
: with-profiler-pane ( gadget quot -- )
[ pane>> ] dip with-pane ;
2007-09-20 18:09:08 -04:00
: com-full-profile ( gadget -- )
[ profile. ] with-profiler-pane ;
: com-vocabs-profile ( gadget -- )
[ vocabs-profile. ] with-profiler-pane ;
2008-02-16 16:54:53 -05:00
: com-method-profile ( gadget -- )
[ method-profile. ] with-profiler-pane ;
2008-06-08 16:32:55 -04:00
: profiler-help ( -- ) "ui-profiler" help-window ;
2007-09-20 18:09:08 -04:00
\ profiler-help H{ { +nullary+ t } } define-command
profiler-gadget "toolbar" f {
{ f com-full-profile }
{ f com-vocabs-profile }
2008-02-16 16:54:53 -05:00
{ f com-method-profile }
2007-09-20 18:09:08 -04:00
{ T{ key-down f f "F1" } profiler-help }
} define-command-map
GENERIC: profiler-presentation ( obj -- quot )
M: usage-profile profiler-presentation
word>> '[ _ usage-profile. ] ;
2007-09-20 18:09:08 -04:00
M: vocab-profile profiler-presentation
vocab>> '[ _ vocab-profile. ] ;
2007-09-20 18:09:08 -04:00
M: f profiler-presentation
drop [ vocabs-profile. ] ;
M: profiler-gadget call-tool* ( obj gadget -- )
swap profiler-presentation with-profiler-pane ;