-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays sequences sorting assocs colors.constants fry
 combinators combinators.smart combinators.short-circuit editors make


\ error-list-help H{ { +nullary+ t } } define-command

error-list-gadget "toolbar" f {
    { T{ key-down f f "F1" } error-list-help }
} define-command-map

: error-list-window ( -- )
    error-list-model get [ drop all-errors ] <arrow>
    <error-list-gadget> "Errors" open-status-window ;

: show-error-list ( -- )
    [ error-list-gadget? ] find-window
    [ raise-window ] [ error-list-window ] if* ;

\ show-error-list H{ { +nullary+ t } } define-command

    [ swap '[ error-type _ at ] filter ] <smart-arrow> ;

:: <error-list-gadget> ( model -- gadget )
    vertical \ error-list-gadget new-track
        <error-toggle> [ >>error-toggle ] [ >>visible-errors ] bi*
        dup visible-errors>> model <error-model> >>model 
        f <model> >>source-file
