=/      !"#$%&'()*+,-.SafeThe ItemField is the central management of the set of items and their current states. There is simply a number of collections of items, expressing only the number of items in the collection., although there may be a group name associated with each collection.jEach item has a corresponding state, which is maintained in parallel and an item's state can be modified.8Currently "selected" item (usually where the cursor is).Actual item counts, possibly with a group name/Current state of each item (length == cntItems)=Function returning an item description given the item number(Returns the count of the number of itemssStandard factory to create an ItemField from a specification of Items and their potential identification function. /   /Safe0@Updates the state of the specified item number to the new state.1;Returns the list of the currently marked items in the field2hgroupRange returns a tuple of the first and last indices of items in group of which item n is a member.3?setAllFree Converts the state of all items in the field to Free012301230123None4When processing a global EvMouseDown VtyEvent, the coordinates of the mouse event on the screen must be mapped to a specific location in a Widget. The 5 function will return the "extent" of the Widget (i.e. where it was drawn and how big it is) but this only indicates that the widget was clicked and does not identify the actual location within the widget where the click occurred.The 4 function translates the mouse event coordinates to a specific location within the widget in the widget's local reference frame, taking into account any scrolling that has occurred within a viewport that wraps that widget.drawUI st = reportExtent (getName st) $ viewport (getName st) Vertical $ Widget Fixed Fixed $ ...handleEvent event st = case event of EvMouseDown col row button _mods -> do wcoords <- getEventWidgetLocation fieldw col row case wcoords of Nothing -> return fieldw Just l -> ...46789:44None The , is the base attribute for the entire WidgetThe { is the attribute for the items portion of the Widget. It does not apply to the headers or the current selection status.The z applies to showing an item state that is Free, which is usually the default state for an unselected, un-evaluated item.The > applies to showing an item that is Marked for future action.The - indicates an item that is in the Good state.The , indicates an item that is in the Bad state.The / indicates an item that is in the Pending stateThe ] is an interstitial attribute marker for portions of the ItemField that are to be left blankThe  is used when the  ItemField rendering would overflow the available space, so the bottom of the rendering includes a message indicating there is more to display.The - is used for the message displayed when the  ItemField contains no actual items.The q is used for the details info for the currently selected item that is displayed at the bottom of the itemfield. The  , is used for group headers in the ItemField.!~This defines the list of default attribute values for this itemfield. To apply these to the default attrbute specifications: _App { ... , appAttrMap = const $ applyAttrMappings itemDefaultAttrs defaultAttrs ... } and to override these defaults: App { ... , appAttrMap = const $ applyAttrMappings [ (itemHeaderAddr, fg cyan), ... ] $ applyAttrMappings itemDefaultAttrs defaultAttrs ... } 'where defaultAttrs for Brick < 0.16 is: -import Data.Default (def) defaultAttrs = def 'and for Brick >= 0.16, defaultAttrs is: Himport Graphics.Vty.Attrs (defAttrs) defaultAttrs = attrMap defAttrs []  !  !  !Safe;<None =The FieldUpdateFunc modifies the current selection in an ItemField, returning the old selection, the new selection, the range over which the selection changed, and the updated field.>LineIndexRange is the Item indices for each line. This is similar to the LinePosRange, except that the latter has character positions on screen.?wLinePosRange is the layout range of the items plotted on a line, indicating the start column and length for that line.@?Pre-compute the rendering information such as the number of items per line and their offset. This information is computed once and used for various calculations. This could have been implemented as a MonadReader context, but the uses are all internal and fairly simple, so direct argument passing is used for now.Awidth and line positionsBGiven the current display width, computes the LinePosRange (x offset and count) of each line that would be displayed. The display of items for each group will be wrapped such that it does not exceed the display width; the exception is if the group text would exceed the display width, in which case there is no wrapping for the groups and horizontal scrolling is indicated and the render data width will be reset to the maximum width of the longest rendered line without wrapping.CwThis is the overall drawing routine. It generates a number of lines that include the individual item states (via the DC function below), along with any general messages or placeholders.DThis is the main internal drawing routine. Given the RenderData calculations, the array of items, and the matching array of current item states, this generates a list of each plotline.EoGiven the ItemField state, return the rendered line number and character offset for the current selected item.FZGiven coordinates, return an indication of which item(s) is selected by those coordinates)=GHIJ>KL?M@ANOPQRSTUVWXYZBCDEF[\]^_`abcde)=GHIJ>KL?M@ANOPQRSTUVWXYZBCDEF[\]^_`abcde#=GHIJ>KL?M@ANOPQRSTUVWXYZBCDEF[\]^_`abcde1Selectable field of items and their current state(c) Kevin Quick, 2016BSD-3quick@sparq.orgstablePOSIXNone9;<="FThis is the main widget for managing an ItemFieldWidget in a brick UI.&This is the primary drawing description for the ItemField. This draws the widget in a viewport with the same name as the widget, using the Fixed horizontal and vertical growth policies.'This is a handler that can be called from a higher level brick Event handler to allow the item field to handle any keys or other events that have not been handled by that higher level handler. This handler provides handling for: movement via arrow keys and the f and g keystoggling marking items: space = current item L = current line G = current group A = all itemsGextending marking by holding shift while using left or right arrow keysTmarking all items with a particular status by using the corrsponding key: +, !, or ~(Useful function for writing custom event handlers for the ItemFieldWidget. This wrapper can provide the width of the rendered ItemFieldWidget to the custom event handler.hSelect specific item by IdiSelect the next or previous item in the item field, moving the cursor accordingly. The first argument should be true if the state of the newly selected item should be the same as the state of the current item.jSelect the next or previous item in the item field, moving the cursor accordingly. The first argument should be true if the state of the newly selected item should be the same as the state of the current item.kzMove the selection forward or backward by the specified number of items in the first argument. Movement will be stopped at the first or last item, so specifying a move beyond those boundaries is safe. The second argument is a boolean that specifies the extension of the current items state across the selection movement (similar to the use of the boolean argument for the i and j functions).lzMove the selection forward or backward by the specified number of items in the first argument. Movement will be stopped at the first or last item, so specifying a move beyond those boundaries is safe. The second argument is a boolean that specifies the extension of the current items state across the selection movement (similar to the use of the boolean argument for the i and j functions).mMove the selection to the next line or previous line. The first argument specifies the rendering width of the region (viewport) that contains the ItemFieldWidget, which allows it to compute the line lengths to determine what the target item is for a forward or backward line motion. The boolean argument specifies whether the intervening and target selection item's states are to be set to the current item's state, just as with the k and l functions.nMove the selection to the next line or previous line. The first argument specifies the rendering width of the region (viewport) that contains the ItemFieldWidget, which allows it to compute the line lengths to determine what the target item is for a forward or backward line motion. The boolean argument specifies whether the intervening and target selection item's states are to be set to the current item's state, just as with the k and l functions.)FReturns the index of the currently selected item in the Widget's field*DReturns the list of the currently marked items in the Widget's field+GModifies the state of the specified item in the widget to the new value,?Modifies the state of all currently marked items in the widget.!o"#$%&pqrst'(hijklmCthe rendering width of the region that contains the ItemFieldWidgetIshould items between source and destination be set to the source's state?/ItemFieldWidget to operate on and output EventMnCthe rendering width of the region that contains the ItemFieldWidgetIshould items between source and destination be set to the source's state?/ItemFieldWidget to operate on and output EventMuvwxyz{)*+,-.-  !"#$%&'()*+,-  "#$%&'(+)*, !o"#$%&pqrst'(hijklmnuvwxyz{)*+,-.|      !"#$%&'())*+,-./0123456789:;<=;>?;>@;>A;>BCDEFGHFIJKLMNNOPQRSTUVWLXMYZ[\]^_`abcdefghijklmnopqrsqrtuvwxyz{|}~(itemfield-1.2.4.2-1ddwpv73pNzBFVaGsE3MLqTextUI.ItemFieldTextUI.ItemField.TypesTextUI.ItemField.OperationsTextUI.ItemField.BrickHelperTextUI.ItemField.AttrsCompatTextUI.ItemField.Layout ItemFieldItemFldcurSelitemsitemst8 elemIdent ItemIdent ItemStateFreeMarkedGoodBadPendingItems ItemGroupNumItems GroupNamenumItemscntItems newItemFielditemAttr itemFieldAttr itemFreeAttritemMarkedAttr itemGoodAttr itemBadAttritemPendingAttr itemBlankAttritemMoreMessageAttritemNoneMessageAttritemSelectedDetailsAttritemHeaderAttritemDefaultAttrsItemFieldWidget itemFieldName itemFielditemFieldWidgethandleItemFieldEventwithItemFieldWidthgetSelectedItemgetMarkedItems setItemStatesetMarkedItemsState$fNamedItemFieldWidgetn$fShowItemFieldWidget$fShowItemFieldchangeItemState getMarked groupRange setAllFreegetEventWidgetLocation!brick-0.17-5hX6Dlj6buGAf3XINUos5V Brick.Main lookupExtent Brick.BChan readBChan writeBChannewBChanBChanvty-5.15-C3we1pXBWr1L9EV4hxaWtDGraphics.Vty.Config defaultConfigbase Data.Foldablelength Data.Functor<$>FieldUpdateFuncLineIndexRange LinePosRange RenderDatacomputeLinePosRangesredrawSt8LinesplotcurLinecoordinatesSel ItemLocation ItemLocNum ItemLocGroupPlotLine EmptyLine renderedLines renderWidth lineStart lineWidthlineEndlineFirstIndex lineLastIndex lineIndicesssRep groupSepText groupSepImgaSpaceaSpacescoordinatesGrouppos_coordinatesupdate_positionbounded boundedIdx select_next select_prevselect_forward_nselect_backward_nselect_next_lineselect_prev_lineghc-prim GHC.Classes<> selectItemNumselectNextItemselectPrevItemselectForwardByselectBackwardByselectNextLineItemselectPrevLineItemItemFieldEventHandler fieldImageWsummaryWitemFieldRenderidentSelitemFieldGetPos selectUpdate toggleMarksetMarktoggleAllMarkstoggleGroupMarkstoggleNamedGroupMarkstoggleLineMarks