! 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
-memoize compiler.errors compiler.units fonts kernel io.pathnames
-prettyprint tools.test help.lint stack-checker.errors
+memoize compiler.units fonts kernel io.pathnames prettyprint
source-files.errors math.parser init math.order models models.arrow
models.arrow.smart models.search models.mapping debugger namespaces
summary locals ui ui.commands ui.gadgets ui.gadgets.panes
ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers
ui.tools.inspector ui.gadgets.status-bar ui.operations
ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs
-ui.gadgets.labels ui.baseline-alignment ui.images ;
+ui.gadgets.labels ui.baseline-alignment ui.images
+compiler.errors ;
IN: ui.tools.error-list
-CONSTANT: error-types
- {
- +compiler-warning+
- +compiler-error+
- +test-failure+
- +help-lint-failure+
- +linkage-error+
- }
-
-MEMO: error-list-icon ( object -- object )
- "vocab:ui/tools/error-list/icons/" ".tiff" surround <image-name> ;
-
-: error-icon ( type -- icon )
- {
- { +compiler-error+ [ "compiler-error" ] }
- { +compiler-warning+ [ "compiler-warning" ] }
- { +test-failure+ [ "unit-test-error" ] }
- { +help-lint-failure+ [ "help-lint-error" ] }
- { +linkage-error+ [ "linkage-error" ] }
- } case error-list-icon ;
+CONSTANT: source-file-icon
+ T{ image-name f "vocab:ui/tools/error-list/icons/source-file.tiff" }
+
+MEMO: error-icon ( type -- image-name )
+ error-icon-path <image-name> ;
: <checkboxes> ( alist -- gadget )
[ <shelf> { 15 0 } >>gap ] dip
SINGLETON: source-file-renderer
-: source-file-icon ( -- image-name )
- "source-file" error-list-icon ;
-
M: source-file-renderer row-columns
drop first2
[ [ source-file-icon ] [ ] [ length number>string ] tri* ] output>array ;
[ invoke-primary-operation ] >>action
COLOR: dark-gray >>column-line-color
6 >>gap
- 10 >>min-rows
- 10 >>max-rows
+ 5 >>min-rows
+ 5 >>max-rows
60 >>min-cols
60 >>max-cols
t >>selection-required?
[ invoke-primary-operation ] >>action
COLOR: dark-gray >>column-line-color
6 >>gap
- 20 >>min-rows
- 20 >>max-rows
+ 5 >>min-rows
+ 5 >>max-rows
60 >>min-cols
60 >>max-cols
t >>selection-required?
M: updater definitions-changed
2drop
- [
- compiler-errors get-global values %
- test-failures get-global %
- lint-failures get-global values %
- ] { } make
+ all-errors
compiler-error-model get-global
set-model ;
: error-list-window ( -- )
compiler-error-model get-global <error-list-gadget>
- "Compiler errors" open-status-window ;
\ No newline at end of file
+ "Errors" open-status-window ;
\ No newline at end of file
source-files.errors ;
IN: compiler.errors
-SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
-
TUPLE: compiler-error < source-file-error ;
M: compiler-error source-file-error-type error>> source-file-error-type ;
compiler-errors [ H{ } clone ] initialize
+SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
+
++compiler-error+ "vocab:ui/tools/error-list/icons/compiler-error.tiff" [ compiler-errors get values ] define-error-type
++compiler-warning+ "vocab:ui/tools/error-list/icons/compiler-warning.tiff" [ f ] define-error-type
++linkage-error+ "vocab:ui/tools/error-list/icons/linkage-error.tiff" [ f ] define-error-type
+
SYMBOL: with-compiler-errors?
: errors-of-type ( type -- assoc )
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs kernel math.order sorting sequences definitions ;
+USING: accessors assocs kernel math.order sorting sequences definitions
+namespaces arrays ;
IN: source-files.errors
TUPLE: source-file-error error asset file line# ;
[
[ swap file>> = ] [ swap source-file-error-type = ]
bi-curry* bi and not
- ] 2curry filter-here ;
\ No newline at end of file
+ ] 2curry filter-here ;
+
+SYMBOL: source-file-error-types
+
+source-file-error-types [ V{ } clone ] initialize
+
+: error-types ( -- seq ) source-file-error-types get keys ;
+
+: define-error-type ( type icon quot -- )
+ 2array swap source-file-error-types get set-at ;
+
+: error-icon-path ( type -- icon )
+ source-file-error-types get at first ;
+
+: all-errors ( -- errors )
+ source-file-error-types get
+ [ second second call( -- seq ) ] map
+ concat ;
\ No newline at end of file