Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-ide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-ide
Commits
ac861cb2
Commit
ac861cb2
authored
Jan 20, 2005
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only draw visible lines during update,
compute line width only for new lines when lines are added
parent
83ed9db0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
33 deletions
+48
-33
Util/FilteredListBox.icl
Util/FilteredListBox.icl
+48
-33
No files found.
Util/FilteredListBox.icl
View file @
ac861cb2
...
@@ -16,6 +16,7 @@ from commondef import strictSeq
...
@@ -16,6 +16,7 @@ from commondef import strictSeq
,
pen
::
![
PenAttribute
]
,
pen
::
![
PenAttribute
]
,
ifilter
::
!{#
Char
}
->
Bool
// the item filter
,
ifilter
::
!{#
Char
}
->
Bool
// the item filter
,
aitems
::
![
String
]
// all items (unfiltered)
,
aitems
::
![
String
]
// all items (unfiltered)
,
domain
::
!
Rectangle
}
}
::
FilteredListBoxId
::
FilteredListBoxId
...
@@ -98,6 +99,7 @@ where
...
@@ -98,6 +99,7 @@ where
,
pen
=
penAtts
,
pen
=
penAtts
,
ifilter
=
const
True
,
ifilter
=
const
True
,
aitems
=
items
,
aitems
=
items
,
domain
=
domain
}
}
listboxAtts
=
map
toLBCA
(
filter
isListBoxControlAttribute
attrs
)
listboxAtts
=
map
toLBCA
(
filter
isListBoxControlAttribute
attrs
)
...
@@ -134,7 +136,7 @@ where
...
@@ -134,7 +136,7 @@ where
#
listboxState
=
{
listboxState
&
ifilter
=
filt
,
items
=
items
}
#
listboxState
=
{
listboxState
&
ifilter
=
filt
,
items
=
items
}
// refresh...
// refresh...
#
(
newDomain
,
ps
)
=
calcControlDomain
pen
items
ps
#
(
newDomain
,
ps
)
=
calcControlDomain
pen
items
ps
#
(
newLook
,
listboxState
)=
customlook
listboxState
#
(
newLook
,
listboxState
)=
customlook
{
listboxState
&
domain
=
newDomain
}
#
ps
=
appPIO
(
seq
#
ps
=
appPIO
(
seq
[
setControlViewDomain
customId
newDomain
[
setControlViewDomain
customId
newDomain
,
setControlLooks
[(
customId
,
True
,(
True
,
newLook
))]
,
setControlLooks
[(
customId
,
True
,(
True
,
newLook
))]
...
@@ -184,42 +186,41 @@ where
...
@@ -184,42 +186,41 @@ where
=
(
FOutGetItems
items
,((
listboxState
,
ls
),
ps
))
=
(
FOutGetItems
items
,((
listboxState
,
ls
),
ps
))
// Append elements:
// Append elements:
receiver
(
FInAppendItems
newItems
)
((
listboxState
=:{
pen
,
items
,
aitems
,
ifilter
,
lineHeight
,
initHeight
},
ls
),
ps
)
receiver
(
FInAppendItems
newItems
)
((
listboxState
=:{
pen
,
items
,
aitems
,
ifilter
,
lineHeight
,
initHeight
,
domain
},
ls
),
ps
)
#
listboxState
=
{
listboxState
&
items
=
allItems
,
aitems
=
aitems
++
newItems
}
#
listboxState
=
{
listboxState
&
items
=
all
Filtered
Items
,
aitems
=
aitems
++
newItems
}
|
length
newItems`
==
0
|
isEmpty
filteredNewItems
=
(
FOutAppendItems
,((
listboxState
,
ls
),
ps
))
=
(
FOutAppendItems
,((
listboxState
,
ls
),
ps
))
#
(
newDomain
,
ps
)
=
calcControlDomain
pen
allItems
ps
#
(
newDomain
,
ps
)
=
adjustControlDomain
pen
filteredNewItems
domain
ps
#
(
newLook
,
listboxState
)=
customlook
listboxState
#
(
newLook
,
listboxState
)=
customlook
{
listboxState
&
domain
=
newDomain
}
#
(
delta
,
ps
)
=
scrolltoend
newDomain
ps
#
(
wdef
,
ps
)
=
accPIO
(
getParentWindow
customId
)
ps
#
delta
=
scrolltoend
newDomain
wdef
#
ps
=
appPIO
(
seq
#
ps
=
appPIO
(
seq
[
setControlLooks
[(
customId
,
False
,(
True
,
newLook
))]
[
setControlLooks
[(
customId
,
False
,(
True
,
newLook
))]
,
setControlViewDomain
customId
newDomain
,
setControlViewDomain
customId
newDomain
,
moveControlViewFrame
customId
{
vx
=
0
,
vy
=
delta
}
,
if
(
delta
==
0
)
id
(
moveControlViewFrame
customId
{
vx
=
0
,
vy
=
delta
})
])
ps
])
ps
=
(
FOutAppendItems
,((
listboxState
,
ls
),
ps
))
=
(
FOutAppendItems
,((
listboxState
,
ls
),
ps
))
where
where
customId
=
listboxState
.
listboxId
.
fcontrolId
customId
=
listboxState
.
listboxId
.
fcontrolId
newItems`
=
filter
ifilter
newItems
filteredNewItems
=
filter
ifilter
newItems
all
Items
=
items
++
newItems`
all
FilteredItems
=
items
++
filteredNewItems
scrolltoend
dom
=:{
corner2
={
y
=
bot
}}
ps
scrolltoend
dom
=:{
corner2
={
y
=
bot
}}
wdef
#
(
wdef
,
ps
)
=
accPIO
(
getParentWindow
customId
)
ps
|
isNothing
wdef
|
isNothing
wdef
=
(
zero
,
ps
)
=
zero
#
wdef
=
fromJust
wdef
#
wdef
=
fromJust
wdef
#
(
exists
,
frame
)
=
getControlViewFrame
customId
wdef
#
(
exists
,
frame
)
=
getControlViewFrame
customId
wdef
|
not
exists
||
isNothing
frame
|
not
exists
||
isNothing
frame
=
(
zero
,
ps
)
=
zero
#
frame
=
fromJust
frame
#
frame
=
fromJust
frame
#
delta
=
bot
-
frame
.
corner2
.
y
=
bot
-
frame
.
corner2
.
y
=
(
delta
,
ps
)
// Remove elements:
// Remove elements:
// Remove all:
// Remove all:
receiver
(
FInCloseAllItems
)
((
listboxState
=:{
listboxId
,
pen
,
items
,
selection
,
lineHeight
,
initHeight
},
ls
),
ps
)
receiver
(
FInCloseAllItems
)
((
listboxState
=:{
listboxId
,
pen
,
items
,
selection
,
lineHeight
,
initHeight
},
ls
),
ps
)
#
listboxState
=
{
listboxState
&
items
=[],
aitems
=
[],
selection
=[]}
#
listboxState
=
{
listboxState
&
items
=[],
aitems
=
[],
selection
=[]}
#
(
newDomain
,
ps
)=
calcControlDomain
pen
[]
ps
#
(
newDomain
,
ps
)=
calcControlDomain
pen
[]
ps
#
(
newLook
,
listboxState
)=
customlook
listboxState
#
(
newLook
,
listboxState
)=
customlook
{
listboxState
&
domain
=
newDomain
}
#
ps
=
appPIO
(
seq
#
ps
=
appPIO
(
seq
[
setControlViewDomain
listboxId
.
fcontrolId
newDomain
[
setControlViewDomain
listboxId
.
fcontrolId
newDomain
,
setControlLooks
[(
listboxId
.
fcontrolId
,
True
,(
True
,
newLook
))]
,
setControlLooks
[(
listboxId
.
fcontrolId
,
True
,(
True
,
newLook
))]
...
@@ -231,12 +232,8 @@ where
...
@@ -231,12 +232,8 @@ where
#
pen
=
removeDupAtt
(
newpen
++
pen
)
#
pen
=
removeDupAtt
(
newpen
++
pen
)
#
(
newDomain
,
ps
)
=
calcControlDomain
pen
items
ps
#
(
newDomain
,
ps
)
=
calcControlDomain
pen
items
ps
#
((
lineHeight
,
initHeight
),
ps
)
=
accScreenPicture
(
liheights
pen
)
ps
#
((
lineHeight
,
initHeight
),
ps
)
=
accScreenPicture
(
liheights
pen
)
ps
#
listboxState
=
#
listboxState
{
listboxState
=
{
listboxState
&
domain
=
newDomain
,
pen
=
pen
,
lineHeight
=
lineHeight
,
initHeight
=
initHeight
}
&
pen
=
pen
,
lineHeight
=
lineHeight
,
initHeight
=
initHeight
}
#
(
newLook
,
listboxState
)=
customlook
listboxState
#
(
newLook
,
listboxState
)=
customlook
listboxState
#
ps
=
appPIO
(
seq
#
ps
=
appPIO
(
seq
[
setControlViewDomain
listboxId
.
fcontrolId
newDomain
[
setControlViewDomain
listboxId
.
fcontrolId
newDomain
...
@@ -251,8 +248,7 @@ where
...
@@ -251,8 +248,7 @@ where
calcControlDomain
::
![.
PenAttribute
]
![.{#
Char
}]
!*(
PSt
.
a
)
->
*(!.
Rectangle
,!*
PSt
.
a
);
calcControlDomain
::
![.
PenAttribute
]
![.{#
Char
}]
!*(
PSt
.
a
)
->
*(!.
Rectangle
,!*
PSt
.
a
);
calcControlDomain
pen
items
ps
calcControlDomain
pen
items
ps
#
(
newDomain
,
ps
)
=
accPIO
(
accScreenPicture
calc
)
ps
=
accPIO
(
accScreenPicture
calc
)
ps
=
(
newDomain
,
ps
)
where
where
calc
pic
calc
pic
#
pic
=
setPenAttributes
pen
pic
#
pic
=
setPenAttributes
pen
pic
...
@@ -265,6 +261,19 @@ where
...
@@ -265,6 +261,19 @@ where
#
newDomain
=
{
corner1
=
zero
,
corner2
={
x
=
maxWidth
,
y
=
height
}}
// calculate new domain...
#
newDomain
=
{
corner1
=
zero
,
corner2
={
x
=
maxWidth
,
y
=
height
}}
// calculate new domain...
=
(
newDomain
,
pic
)
=
(
newDomain
,
pic
)
adjustControlDomain
::
![.
PenAttribute
]
![.{#
Char
}]
!.
Rectangle
!*(
PSt
.
a
)
->
*(!.
Rectangle
,!*
PSt
.
a
);
adjustControlDomain
pen
items
{
corner2
={
x
=
oldMaxWidth
,
y
=
oldHeight
}}
ps
=
accPIO
(
accScreenPicture
calc
)
ps
where
calc
pic
#
pic
=
setPenAttributes
pen
pic
#
(
metrics
,
pic
)
=
getPenFontMetrics
pic
#
(
itemWidths
,
pic
)
=
getPenFontStringWidths
items
pic
#
maxWidth
=
maxList
[
oldMaxWidth
:
itemWidths
]
#
nrItems
=
length
items
#
height
=
oldHeight
+
nrItems
*(
fontLineHeight
metrics
)
#
newDomain
=
{
corner1
=
zero
,
corner2
={
x
=
maxWidth
,
y
=
height
}}
// calculate new domain...
=
(
newDomain
,
pic
)
removeDupAtt
[
x
:
xs
]
=
[
x
:
removeDupAtt
(
filter
(
diff
x
)
xs
)]
removeDupAtt
[
x
:
xs
]
=
[
x
:
removeDupAtt
(
filter
(
diff
x
)
xs
)]
where
where
...
@@ -281,16 +290,22 @@ customlook ls=:{items,selection,pen,lineHeight,initHeight}
...
@@ -281,16 +290,22 @@ customlook ls=:{items,selection,pen,lineHeight,initHeight}
=
(
customlook
,
ls
)
=
(
customlook
,
ls
)
where
where
customlook
_
{
newFrame
}
pict
customlook
_
{
newFrame
}
pict
#
min_y
=
newFrame
.
corner1
.
y
#
max_y
=
newFrame
.
corner2
.
y
#
pict
=
setPenAttributes
pen
pict
#
pict
=
setPenAttributes
pen
pict
#
pict
=
unfill
newFrame
pict
#
pict
=
unfill
newFrame
pict
#
(_,
pict
)
=
strictSeq
[
drawline
item
\\
item
<-
items
]
(
initHeight
,
pict
)
#
(_,
pict
)
=
foldl
drawline
(
initHeight
,
pict
)
items
with
drawline
(
y
,
p
)
line
|
y
<
min_y
||
y
-
lineHeight
>
max_y
=
(
y
+
lineHeight
,
p
)
=
(
y
+
lineHeight
,
drawAt
{
x
=
0
,
y
=
y
}
line
p
)
#
pict
=
strictSeq
[
drawsel
sel
\\
sel
<-
selection
]
pict
#
pict
=
strictSeq
[
drawsel
sel
\\
sel
<-
selection
]
pict
=
pict
=
pict
where
where
(
x1
,
x2
)
=
(
newFrame
.
corner1
.
x
,
newFrame
.
corner2
.
x
)
x1
=
newFrame
.
corner1
.
x
x2
=
newFrame
.
corner2
.
x
drawsel
i
=
hilite
{
corner1
={
x
=
x1
,
y
=(
i
-1
)*
lineHeight
},
corner2
={
x
=
x2
,
y
=
i
*
lineHeight
-1
}}
drawsel
i
=
hilite
{
corner1
={
x
=
x1
,
y
=(
i
-1
)*
lineHeight
},
corner2
={
x
=
x2
,
y
=
i
*
lineHeight
-1
}}
drawline
line
(
y
,
p
)
=
(
y
+
lineHeight
,
drawAt
{
x
=
0
,
y
=
y
}
line
p
)
//--
//--
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment