2069 "/ ^ self buttonPress:button x:x y:y |
2069 "/ ^ self buttonPress:button x:x y:y |
2070 "/ ]. |
2070 "/ ]. |
2071 enabled ifTrue:[ |
2071 enabled ifTrue:[ |
2072 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2072 listLineNr := self visibleLineToListLine:(self visibleLineOfY:y). |
2073 listLineNr notNil ifTrue:[ |
2073 listLineNr notNil ifTrue:[ |
2074 (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self]. |
2074 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2075 |
2075 |
2076 (selectConditionBlock notNil |
2076 (selectConditionBlock notNil |
2077 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
2077 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
2078 ]. |
2078 ]. |
2079 oldSelection := selection copy. |
2079 oldSelection := selection copy. |
2096 ] |
2096 ] |
2097 ] ifFalse:[ |
2097 ] ifFalse:[ |
2098 super buttonPress:button x:x y:y |
2098 super buttonPress:button x:x y:y |
2099 ] |
2099 ] |
2100 |
2100 |
2101 "Created: 14.11.1996 / 15:51:41 / cg" |
2101 "Created: / 14.11.1996 / 15:51:41 / cg" |
2102 "Modified: 17.6.1997 / 18:03:19 / cg" |
2102 "Modified: / 8.8.1998 / 03:24:03 / cg" |
2103 ! |
2103 ! |
2104 |
2104 |
2105 buttonMotion:buttonMask x:x y:y |
2105 buttonMotion:buttonMask x:x y:y |
2106 "mouse-move while button was pressed - handle selection changes" |
2106 "mouse-move while button was pressed - handle selection changes" |
2107 |
2107 |
2762 ! |
2762 ! |
2763 |
2763 |
2764 isValidSelection:aNumberOrCollection |
2764 isValidSelection:aNumberOrCollection |
2765 "return true, if aNumber is ok as a selection index" |
2765 "return true, if aNumber is ok as a selection index" |
2766 |
2766 |
|
2767 |sz| |
|
2768 |
2767 aNumberOrCollection isNil ifTrue:[^ false]. |
2769 aNumberOrCollection isNil ifTrue:[^ false]. |
2768 |
2770 |
|
2771 sz := self size. |
2769 (aNumberOrCollection isCollection) ifTrue:[ |
2772 (aNumberOrCollection isCollection) ifTrue:[ |
2770 multipleSelectOk ifFalse:[^ false]. |
2773 multipleSelectOk ifFalse:[^ false]. |
2771 aNumberOrCollection do:[:index | |
2774 aNumberOrCollection do:[:index | |
2772 (index between:1 and:self size) ifFalse:[^ false]. |
2775 (index between:1 and:sz) ifFalse:[^ false]. |
2773 ]. |
2776 (self lineIsEnabled:index) ifFalse:[^ false]. |
2774 ^ true. |
2777 ]. |
2775 ] ifFalse:[ |
2778 ] ifFalse:[ |
2776 ^ (aNumberOrCollection between:1 and:self size). |
2779 (aNumberOrCollection between:1 and:sz) ifFalse:[^ false]. |
2777 ]. |
2780 (self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false]. |
2778 |
2781 ]. |
|
2782 ^ true. |
|
2783 |
|
2784 "Modified: / 8.8.1998 / 03:34:27 / cg" |
|
2785 ! |
|
2786 |
|
2787 lineIsEnabled:lineNr |
|
2788 ^ (self line:lineNr hasAttribute:#disabled) not |
|
2789 |
|
2790 "Modified: / 8.8.1998 / 03:22:50 / cg" |
2779 ! |
2791 ! |
2780 |
2792 |
2781 positionToSelectionX:x y:y |
2793 positionToSelectionX:x y:y |
2782 "given a click position, return the selection lineNo" |
2794 "given a click position, return the selection lineNo" |
2783 |
2795 |
2814 (toggleSelect |
2826 (toggleSelect |
2815 and:[self isInSelection:listLineNr]) ifTrue:[ |
2827 and:[self isInSelection:listLineNr]) ifTrue:[ |
2816 oldSelection := selection copy. |
2828 oldSelection := selection copy. |
2817 self removeFromSelection:listLineNr |
2829 self removeFromSelection:listLineNr |
2818 ] ifFalse:[ |
2830 ] ifFalse:[ |
2819 (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self]. |
2831 (self lineIsEnabled:listLineNr) ifFalse:[^ self]. |
2820 |
2832 |
2821 (selectConditionBlock notNil |
2833 (selectConditionBlock notNil |
2822 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
2834 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self]. |
2823 |
2835 |
2824 (toggleSelect and:[multipleSelectOk]) ifTrue:[ |
2836 (toggleSelect and:[multipleSelectOk]) ifTrue:[ |
2990 self paint:fg on:bg. |
3002 self paint:fg on:bg. |
2991 dObj displayOn:self x:0 y:y opaque:true. |
3003 dObj displayOn:self x:0 y:y opaque:true. |
2992 ^ self |
3004 ^ self |
2993 ]. |
3005 ]. |
2994 listAttributes notNil ifTrue:[ |
3006 listAttributes notNil ifTrue:[ |
2995 (self line:listLine hasAttribute:#halfIntensity) ifTrue:[ |
3007 ((self line:listLine hasAttribute:#halfIntensity) |
|
3008 or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[ |
2996 fg := halfIntensityFgColor |
3009 fg := halfIntensityFgColor |
2997 ] ifFalse:[ |
|
2998 (self line:listLine hasAttribute:#disabled) ifTrue:[ |
|
2999 fg := halfIntensityFgColor |
|
3000 ]. |
|
3001 ]. |
3010 ]. |
3002 (self line:listLine hasAttribute:#bold) ifTrue:[ |
3011 (self line:listLine hasAttribute:#bold) ifTrue:[ |
3003 newFont := font asBold. |
3012 newFont := font asBold. |
3004 (font bold |
3013 (font bold |
3005 or:[id := (newFont on:device) fontId. |
3014 or:[id := (newFont on:device) fontId. |
3034 ] |
3043 ] |
3035 ] |
3044 ] |
3036 ]. |
3045 ]. |
3037 ^ self drawVisibleLine:visLineNr with:fg and:bg |
3046 ^ self drawVisibleLine:visLineNr with:fg and:bg |
3038 |
3047 |
3039 "Modified: / 21.6.1998 / 03:26:28 / cg" |
3048 "Modified: / 8.8.1998 / 03:42:13 / cg" |
3040 ! |
3049 ! |
3041 |
3050 |
3042 redrawVisibleLine:visLineNr col:colNr |
3051 redrawVisibleLine:visLineNr col:colNr |
3043 "redraw a single character. |
3052 "redraw a single character. |
3044 Must check, if its in the selection and handle this case." |
3053 Must check, if its in the selection and handle this case." |
3168 ] |
3177 ] |
3169 ] ifFalse:[ |
3178 ] ifFalse:[ |
3170 next := selection + 1 |
3179 next := selection + 1 |
3171 ]. |
3180 ]. |
3172 ]. |
3181 ]. |
|
3182 |
3173 (self isValidSelection:next) ifFalse:[ |
3183 (self isValidSelection:next) ifFalse:[ |
3174 next > self size ifTrue:[ |
3184 sz := self size. |
|
3185 next > sz ifTrue:[ |
3175 next := 1. |
3186 next := 1. |
3176 ] ifFalse:[ |
3187 ] ifFalse:[ |
3177 [next <= self size |
3188 [next <= sz |
3178 and:[(self isValidSelection:next) not]] whileTrue:[ |
3189 and:[(self isValidSelection:next) not ]] whileTrue:[ |
3179 next := next + 1 |
3190 next := next + 1 |
3180 ]. |
3191 ]. |
3181 ]. |
3192 ]. |
3182 ]. |
3193 ]. |
|
3194 |
3183 (self isValidSelection:next) ifFalse:[ |
3195 (self isValidSelection:next) ifFalse:[ |
3184 next := nil |
3196 next := nil |
3185 ]. |
3197 ]. |
3186 ^ next |
3198 ^ next |
|
3199 |
|
3200 "Modified: / 8.8.1998 / 03:36:55 / cg" |
3187 ! |
3201 ! |
3188 |
3202 |
3189 numberOfSelections |
3203 numberOfSelections |
3190 "return the number of selected entries" |
3204 "return the number of selected entries" |
3191 |
3205 |