From: <ba...@us...> - 2007-11-04 15:17:17
|
Revision: 9083 http://amsn.svn.sourceforge.net/amsn/?rev=9083&view=rev Author: baaazen Date: 2007-11-04 07:17:19 -0800 (Sun, 04 Nov 2007) Log Message: ----------- * fix for cropped smileys in the smiley selector this patch results in a slightly higher memory consumption, because preview images have to be copied before resizing them, otherwise the copy is cropped -> non-square smileys are still cropped on the longer side, but this is caused by the resize-function in picture.tcl * improved memory consumption for smileys, image delete is now called for all used own emotions before relogin Modified Paths: -------------- trunk/amsn/config.tcl trunk/amsn/smileys.tcl Modified: trunk/amsn/config.tcl =================================================================== --- trunk/amsn/config.tcl 2007-10-31 21:55:04 UTC (rev 9082) +++ trunk/amsn/config.tcl 2007-11-04 15:17:19 UTC (rev 9083) @@ -260,7 +260,7 @@ ::config::setKey globaloverride 0 ;# Sets whether Global nicknames pattern should override custom nicks, disabled by default if { [info exists custom_emotions] } { - unset custom_emotions + ::smiley::UnloadEmoticons } ::smiley::cleanup Modified: trunk/amsn/smileys.tcl =================================================================== --- trunk/amsn/smileys.tcl 2007-10-31 21:55:04 UTC (rev 9082) +++ trunk/amsn/smileys.tcl 2007-11-04 15:17:19 UTC (rev 9083) @@ -203,6 +203,9 @@ #Error when creating smiley's image so we don't add it return 0 } else { + set emotion(preview) [image create photo emoticonCustom_preview_$emotion(text)] + $emotion(preview) copy emoticonCustom_std_$emotion(text) + if {[::config::getKey big_incoming_smileys 0] == 1} { # Make sure the smiley is max 50x50 ::smiley::resizeCustomSmiley emoticonCustom_std_$emotion(text) @@ -744,7 +747,7 @@ set animated [expr {$emotion(animated) && [::config::getKey animatedsmileys 0]}] CreateSmileyInMenu $w.c $cols $rows $smiw $smih \ - $emot_num $name [lindex $emotion(text) 0] $emotion(image_name) $emotion(file) $animated + $emot_num $name [lindex $emotion(text) 0] $emotion(preview) $emotion(file) $animated incr emot_num } @@ -892,8 +895,10 @@ proc NewCustomEmoticonGUI_Delete { name } { global custom_emotions - - catch {image delete $name} + + array set emotion $custom_emotions($name) + catch {image delete $emotion(image_name)} + catch {image delete $emotion(preview)} unset custom_emotions($name) if { [winfo exists .smile_selector]} {destroy .smile_selector} @@ -1101,6 +1106,9 @@ set emotion(image_name) [image create photo emoticonCustom_std_$emotion(text) -file $emotion(file) -format cximage] + set emotion(preview) [image create photo emoticonCustom_preview_$emotion(text)] + $emotion(preview) copy emoticonCustom_std_$emotion(text) + set custom_emotions($name) [array get emotion] #load_smileys @@ -1183,6 +1191,19 @@ return 0 } + + proc UnloadEmoticons { } { + global custom_emotions + + foreach name [array names custom_emotions] { + array set emotion $custom_emotions($name) + catch {[image delete $emotion(image_name)]} + catch {[image delete $emotion(preview)]} + } + + unset custom_emotions + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |