From: <bi...@us...> - 2008-12-21 22:44:01
|
Revision: 10810 http://amsn.svn.sourceforge.net/amsn/?rev=10810&view=rev Author: billiob Date: 2008-12-21 22:43:59 +0000 (Sun, 21 Dec 2008) Log Message: ----------- add a SW/F to the InDPFrame in the CW Modified Paths: -------------- trunk/amsn/chatwindow.tcl trunk/amsn/gui.tcl Modified: trunk/amsn/chatwindow.tcl =================================================================== --- trunk/amsn/chatwindow.tcl 2008-12-21 13:55:08 UTC (rev 10809) +++ trunk/amsn/chatwindow.tcl 2008-12-21 22:43:59 UTC (rev 10810) @@ -171,7 +171,7 @@ # Arguments: # - window => Is the chat window widget (.msg_n - Where n is an integer) proc GetInDisplayPictureFrame { window } { - return [GetInFrame $window].f.pic + return [[GetInFrame $window].f.sw.sf getframe] } #/////////////////////////////////////////////////////////////////////////////// @@ -2493,7 +2493,7 @@ set win_name [::ChatWindow::For $chatid] - set frame_in [GetInFrame $win_name].f.voip + set frame_in [GetInDisplayPictureFrame $win_name].voip set frame_out [GetOutDisplayPicturesFrame $win_name].voip status_log "Creating CW Voip controls" @@ -2553,7 +2553,7 @@ set window [::ChatWindow::For $chatid] - set frame_in [GetInFrame $window].f.voip + set frame_in [GetInDisplayPictureFrame $window].voip set frame_out [GetOutDisplayPicturesFrame $window].voip status_log "Updating CW Voip controls" @@ -2602,7 +2602,7 @@ set win_name [::ChatWindow::For $chatid] - set frame_in [GetInFrame $win_name].f.voip + set frame_in [GetInDisplayPictureFrame $win_name].voip set frame_out [GetOutDisplayPicturesFrame $win_name].voip status_log "Removing CW Voip controls" @@ -3069,15 +3069,20 @@ proc CreatePictureFrame { w bottom } { status_log "Creating picture frame\n" - # Name our widgets - set f $bottom.f + + frame $bottom.f -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + -relief solid -background [::skin::getKey chatwindowbg] + ScrolledWindow $bottom.f.sw -scrollbar vertical -auto vertical -borderwidth 0 + ScrollableFrame $bottom.f.sw.sf -width 0 -bg [::skin::getKey chatwindowbg] + $bottom.f.sw setwidget $bottom.f.sw.sf + + set f [$bottom.f.sw.sf getframe] set frame $f.pic set voip $f.voip set picture $frame.image set showpic $frame.showpic # Create them - frame $f -class Amsn -borderwidth 0 -relief solid -background [::skin::getKey chatwindowbg] frame $frame -class Amsn -borderwidth 0 -relief solid -background [::skin::getKey chatwindowbg] frame $voip -class Amsn -borderwidth 0 -relief solid -background [::skin::getKey chatwindowbg] @@ -3097,6 +3102,7 @@ # Pack them #pack $picture -side left -padx 0 -pady [::skin::getKey chatpady] -anchor w + pack $bottom.f.sw -fill y -anchor ne pack $frame $voip -side top -padx 0 -pady 0 -anchor ne -expand true pack $showpic -side right -padx 0 -pady 0 -anchor ne @@ -3118,7 +3124,7 @@ bind $picture <Configure> "::ChatWindow::ImageResized $w %h [::skin::getKey chat_dp_pady]" } ::amsn::ShowOrHidePicture - return $f + return $bottom.f } @@ -3179,7 +3185,7 @@ # - padding => Is the padding around the image proc ImageResized { win height padding} { #TODO: need to remove hard coding here - set picheight [image height [[GetInDisplayPictureFrame $win].image cget -image]] + set picheight [image height [[GetInDisplayPictureFrame $win].pic.image cget -image]] if { $height < $picheight } { set height $picheight } @@ -4386,7 +4392,7 @@ unset ::ChatWindow::recent_message(${win}) #Delete images if not in use - catch {destroy [GetInDisplayPictureFrame $win]} + catch {destroy [GetInDisplayPictureFrame $win].pic} CloseTab $tab 1 Modified: trunk/amsn/gui.tcl =================================================================== --- trunk/amsn/gui.tcl 2008-12-21 13:55:08 UTC (rev 10809) +++ trunk/amsn/gui.tcl 2008-12-21 22:43:59 UTC (rev 10810) @@ -2323,7 +2323,7 @@ #from the user that left. Then, change it set current_image "" #Catch it, because the window might be closed - catch {set current_image [[::ChatWindow::GetInDisplayPictureFrame $win_name].image cget -image]} + catch {set current_image [[::ChatWindow::GetInDisplayPictureFrame $win_name].pic.image cget -image]} if { [string compare $current_image [::skin::getDisplayPicture $usr_name]]==0} { set users_in_chat [::MSN::usersInChat $chatid] set new_user [lindex $users_in_chat 0] @@ -2479,7 +2479,7 @@ -command "::amsn::ChangePicture $win \[::skin::getDisplayPicture $user\] \[trans showuserpic $user\]" } - set user [[::ChatWindow::GetInDisplayPictureFrame $win].image cget -image] + set user [[::ChatWindow::GetInDisplayPictureFrame $win].pic.image cget -image] if { $user != "[::skin::getNoDisplayPicture]" && $user != "displaypicture_std_self" } { #made easy for if we would change the image names set user [string range $user [string length "displaypicture_std_"] end] @@ -2506,23 +2506,24 @@ #Get the path to the image - set pictureinner [[::ChatWindow::GetInDisplayPictureFrame $win].image getinnerframe] + set f [::ChatWindow::GetInDisplayPictureFrame $win] + set pictureinner [$f.pic.image getinnerframe] if { $balloontext != "" } { #TODO: Improve this!!! Use some kind of abstraction! change_balloon $pictureinner $balloontext #change_balloon [::ChatWindow::GetInDisplayPictureFrame $win].image $balloontext } - if { [catch {[::ChatWindow::GetInDisplayPictureFrame $win].image configure -image $picture}] } { + if { [catch {[::ChatWindow::GetInDisplayPictureFrame $win].pic.image configure -image $picture}] } { status_log "Failed to set picture, using [::skin::getNoDisplayPicture]\n" red - [::ChatWindow::GetInDisplayPictureFrame $win].image configure -image [::skin::getNoDisplayPicture] + [::ChatWindow::GetInDisplayPictureFrame $win].pic.image configure -image [::skin::getNoDisplayPicture] #change_balloon [::ChatWindow::GetInDisplayPictureFrame $win].image [trans nopic] change_balloon $pictureinner [trans nopic] } elseif { $nopack == "" } { - pack [::ChatWindow::GetInDisplayPictureFrame $win].image -side left -padx 0 -pady 0 -anchor w - [::ChatWindow::GetInDisplayPictureFrame $win].showpic configure -image [::skin::loadPixmap imghide] - bind [::ChatWindow::GetInDisplayPictureFrame $win].showpic <Enter> "[::ChatWindow::GetInDisplayPictureFrame $win].showpic configure -image [::skin::loadPixmap imghide_hover]" - bind [::ChatWindow::GetInDisplayPictureFrame $win].showpic <Leave> "[::ChatWindow::GetInDisplayPictureFrame $win].showpic configure -image [::skin::loadPixmap imghide]" - change_balloon [::ChatWindow::GetInDisplayPictureFrame $win].showpic [trans hidedisplaypic] + pack [::ChatWindow::GetInDisplayPictureFrame $win].pic.image -side left -padx 0 -pady 0 -anchor w + [::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic configure -image [::skin::loadPixmap imghide] + bind [::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic <Enter> "[::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic configure -image [::skin::loadPixmap imghide_hover]" + bind [::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic <Leave> "[::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic configure -image [::skin::loadPixmap imghide]" + change_balloon [::ChatWindow::GetInDisplayPictureFrame $win].pic.showpic [trans hidedisplaypic] ::config::setKey showdisplaypic 1 } @@ -2530,6 +2531,22 @@ update idletasks ::ChatWindow::Scroll [::ChatWindow::GetOutText $win] } + #compute the size of the frame + if {[::config::getKey showdisplaypic 1] == 1 } { + set max_width [image width $picture] + if {[winfo exists $f.voip.volume] && $max_width <100} { + set max_width 100 + } + incr max_width [image width [::skin::loadPixmap imghide]] + } else { + set max_width 0 + if {[winfo exists $f.voip.volume] && $max_width <100} { + set max_width 100 + } + incr max_width [image width [::skin::loadPixmap imgshow]] + } + set width [expr {$max_width + (2 * [::skin::getKey chat_dp_border])}] + [winfo parent $f] configure -width $width } proc UpdateAllPictures { } { @@ -2598,7 +2615,7 @@ incr idx } - #compute the size ouf the frame + #compute the size of the frame if {[::config::getKey ShowTopPicture 0] == 1 } { if {[winfo exists $f.voip.volume] && $max_width <100} { set max_width 100 @@ -2612,11 +2629,12 @@ incr max_width [image width [::skin::loadPixmap imgshow]] } set width [expr {$max_width + (2 * [::skin::getKey chat_dp_border])}] - [winfo parent [::ChatWindow::GetOutDisplayPicturesFrame $win]] configure -width $width + [winfo parent $f] configure -width $width } proc HidePicture { win } { - set dpframe [::ChatWindow::GetInDisplayPictureFrame $win] + set f [::ChatWindow::GetInDisplayPictureFrame $win] + set dpframe $f.pic pack forget $dpframe.image #grid [::ChatWindow::GetInDisplayPictureFrame $win].showpic -row 0 -column 1 -padx 0 -pady 0 -rowspan 2 @@ -2627,6 +2645,11 @@ change_balloon $dpframe.showpic [trans showdisplaypic] + set width [expr {2 * [::skin::getKey chat_dp_border]+[image width [::skin::loadPixmap imgshow]]}] + if {[winfo exists $f.voip.volume] && $width <100} { + set width 100 + } + [winfo parent $f] configure -width $width } proc ShowOrHidePicture { } { @@ -2640,7 +2663,7 @@ if {[winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win].dps] } { ::amsn::ChangePicture $win displaypicture_std_self [trans mypic] } else { - ::amsn::ChangePicture $win [[::ChatWindow::GetInDisplayPictureFrame $win].image cget -image] "" + ::amsn::ChangePicture $win [[::ChatWindow::GetInDisplayPictureFrame $win].pic.image cget -image] "" } } else { ::amsn::HidePicture $win This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |