A problem with IconImageManager

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

A problem with IconImageManager

Maxim Fridental
The method ImageManager>>buildImageListWithExtent: (as in 5.1.1) relies on
invariant, that the images size must be exactly the same as the maximal
value, i.e. images keys size = images values asSortedCollection last. This
invariant isn't always satisfied in our image and that leads to an error in
the #buildImageListWithExtent:. We couldn't track the problem to its roots,
but we're supposing that Windows controls changing assigned to them image
lists, more precisely, adding an icon.
To workaround the problem we've changed the abovementioned method:

buildImageListWithExtent: aPoint
 "Private - Build a new image list with the extent specified by the <Point>
argument,
 populating it with all existing images."

 | newList count |
 newList := self newImageListWithExtent: aPoint.
 count := images values inject: 1
    into: [:max :index | index > max ifTrue: [index] ifFalse: [max]].
 1 to: count
  do:
   [:i |
   (images keyAtValue: i ifAbsent: [Icon question]) addToImageList: newList
mask: maskcolor].

 "Add the new rendering to our dictionary of those available"
 imageLists at: aPoint put: newList.
 ^newList