- Timestamp:
- Nov 18, 2008, 8:25:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/htmlviewer.tcl
r785 r1224 53 53 54 54 protected method _getImage {file} 55 private common _icons ;# maps file name => image handle 55 protected method _freeImage {file} 56 private common _file2icon ;# maps file name => image handle 57 private common _icon2file ;# maps image handle => file name 56 58 private variable _dirlist "" ;# list of directories where HTML came from 57 59 } … … 320 322 # ---------------------------------------------------------------------- 321 323 itcl::body Rappture::HTMLviewer::_getImage {fileName} { 322 if {[info exists _icons($fileName)]} { 323 return $_icons($fileName) 324 if {[info exists _file2icon($fileName)]} { 325 set imh $_file2icon($fileName) 326 return [list $imh [itcl::code $this _freeImage]] 324 327 } 325 328 … … 333 336 foreach name $searchlist { 334 337 if {[catch {image create photo -file $name} imh] == 0} { 335 set _icons($fileName) $imh 336 return $imh 338 set _file2icon($fileName) $imh 339 set _icon2file($imh) $fileName 340 return [list $imh [itcl::code $this _freeImage]] 337 341 } 338 342 } 339 343 return [Rappture::icon exclaim] 344 } 345 346 itcl::body Rappture::HTMLviewer::_freeImage { imh } { 347 if {[info exists _icon2file($imh)]} { 348 image delete $imh 349 set fileName $_icon2file($imh) 350 unset _icon2file($imh) 351 unset _file2icon($fileName) 352 } 340 353 } 341 354
Note: See TracChangeset
for help on using the changeset viewer.