irc.ui: Userlists no longer use list gadgets
parent
a757af9da5
commit
804a76afc8
|
@ -5,7 +5,7 @@ USING: accessors kernel threads combinators concurrency.mailboxes
|
||||||
sequences strings hashtables splitting fry assocs hashtables
|
sequences strings hashtables splitting fry assocs hashtables
|
||||||
ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
|
ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
|
||||||
ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
|
ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
|
||||||
ui.gadgets.tabs ui.gadgets.grids ui.gadgets.lists ui.gadgets.labels
|
ui.gadgets.tabs ui.gadgets.grids ui.gadgets.packs ui.gadgets.labels
|
||||||
io io.styles namespaces calendar calendar.format models continuations
|
io io.styles namespaces calendar calendar.format models continuations
|
||||||
irc.client irc.client.private irc.messages irc.messages.private
|
irc.client irc.client.private irc.messages irc.messages.private
|
||||||
irc.ui.commandparser irc.ui.load qualified ;
|
irc.ui.commandparser irc.ui.load qualified ;
|
||||||
|
@ -20,7 +20,7 @@ SYMBOL: client
|
||||||
|
|
||||||
TUPLE: ui-window client tabs ;
|
TUPLE: ui-window client tabs ;
|
||||||
|
|
||||||
TUPLE: irc-tab < frame listener client listmodel ;
|
TUPLE: irc-tab < frame listener client userlist ;
|
||||||
|
|
||||||
: write-color ( str color -- )
|
: write-color ( str color -- )
|
||||||
foreground associate format ;
|
foreground associate format ;
|
||||||
|
@ -116,16 +116,15 @@ M: irc-message write-irc
|
||||||
|
|
||||||
GENERIC: handle-inbox ( tab message -- )
|
GENERIC: handle-inbox ( tab message -- )
|
||||||
|
|
||||||
: filter-participants ( assoc val -- alist )
|
: filter-participants ( pack alist val color -- )
|
||||||
[ >alist ] dip
|
'[ , = [ <label> , >>color add-gadget ] [ drop ] if ] assoc-each ;
|
||||||
'[ second , = ] filter ;
|
|
||||||
|
|
||||||
: update-participants ( tab -- )
|
: update-participants ( tab -- )
|
||||||
[ listmodel>> ] [ listener>> participants>> ] bi
|
[ userlist>> [ clear-gadget ] keep ]
|
||||||
[ +operator+ filter-participants ]
|
[ listener>> participants>> ] bi
|
||||||
[ +voice+ filter-participants ]
|
[ +operator+ green filter-participants ]
|
||||||
[ +normal+ filter-participants ] tri
|
[ +voice+ blue filter-participants ]
|
||||||
append append swap set-model ;
|
[ +normal+ black filter-participants ] 2tri ;
|
||||||
|
|
||||||
M: participant-changed handle-inbox
|
M: participant-changed handle-inbox
|
||||||
drop update-participants ;
|
drop update-participants ;
|
||||||
|
@ -162,11 +161,6 @@ irc-editor "general" f {
|
||||||
{ T{ key-down f f "ENTER" } editor-send }
|
{ T{ key-down f f "ENTER" } editor-send }
|
||||||
} define-command-map
|
} define-command-map
|
||||||
|
|
||||||
: <irc-list> ( -- gadget model )
|
|
||||||
[ drop ]
|
|
||||||
[ first2 [ <label> ] dip >>color ]
|
|
||||||
{ } <model> [ <list> ] keep ;
|
|
||||||
|
|
||||||
: <irc-tab> ( listener client -- irc-tab )
|
: <irc-tab> ( listener client -- irc-tab )
|
||||||
irc-tab new-frame
|
irc-tab new-frame
|
||||||
swap client>> >>client swap >>listener
|
swap client>> >>client swap >>listener
|
||||||
|
@ -175,19 +169,19 @@ irc-editor "general" f {
|
||||||
|
|
||||||
: <irc-channel-tab> ( listener client -- irc-tab )
|
: <irc-channel-tab> ( listener client -- irc-tab )
|
||||||
<irc-tab>
|
<irc-tab>
|
||||||
<irc-list> [ <scroller> @right grid-add ] dip >>listmodel
|
<pile> [ <scroller> @right grid-add ] keep >>userlist ;
|
||||||
[ update-participants ] keep ;
|
|
||||||
|
|
||||||
: <irc-server-tab> ( listener client -- irc-tab )
|
: <irc-server-tab> ( listener client -- irc-tab )
|
||||||
<irc-tab> ;
|
<irc-tab> ;
|
||||||
|
|
||||||
M: irc-tab graft*
|
M: irc-tab graft*
|
||||||
[ listener>> ] [ client>> ] bi
|
[ listener>> ] [ client>> ] bi add-listener ;
|
||||||
add-listener ;
|
|
||||||
|
|
||||||
M: irc-tab ungraft*
|
M: irc-tab ungraft*
|
||||||
[ listener>> ] [ client>> ] bi
|
[ listener>> ] [ client>> ] bi remove-listener ;
|
||||||
remove-listener ;
|
|
||||||
|
M: irc-tab pref-dim*
|
||||||
|
drop { 480 480 } ;
|
||||||
|
|
||||||
: join-channel ( name ui-window -- )
|
: join-channel ( name ui-window -- )
|
||||||
[ dup <irc-channel-listener> ] dip
|
[ dup <irc-channel-listener> ] dip
|
||||||
|
|
Loading…
Reference in New Issue