From: <bi...@us...> - 2008-12-21 10:36:48
|
Revision: 10808 http://amsn.svn.sourceforge.net/amsn/?rev=10808&view=rev Author: billiob Date: 2008-12-21 10:36:44 +0000 (Sun, 21 Dec 2008) Log Message: ----------- use scrollwindow to embed voip controls+ out DPs. but it doesn't behave the way i want :s Modified Paths: -------------- trunk/amsn/chatwindow.tcl trunk/amsn/gui.tcl Modified: trunk/amsn/chatwindow.tcl =================================================================== --- trunk/amsn/chatwindow.tcl 2008-12-19 19:45:47 UTC (rev 10807) +++ trunk/amsn/chatwindow.tcl 2008-12-21 10:36:44 UTC (rev 10808) @@ -146,7 +146,7 @@ #/////////////////////////////////////////////////////////////////////////////// # ::ChatWindow::GetOutText (window) - # Returns the path to the output text widget in a given window + # Returns the path to the output text widget in a given window # Arguments: # - window => Is the chat window widget (.msg_n - Where n is an integer) proc GetOutText { window } { @@ -156,18 +156,18 @@ #/////////////////////////////////////////////////////////////////////////////// # ::ChatWindow::GetDisplayPicturesFrame (window) - # Returns the path to the output DP frame in a given window + # Returns the path to the output DP frame in a given window # Arguments: # - window => Is the chat window widget (.msg_n - Where n is an integer) proc GetOutDisplayPicturesFrame { window } { - return [GetOutFrame $window].f.dps + return [[GetOutFrame $window].f.sw.sf getframe] } #/////////////////////////////////////////////////////////////////////////////// #/////////////////////////////////////////////////////////////////////////////// # ::ChatWindow::GetInputDP (window) - # Returns the path to the input DP in a given window + # Returns the path to the input DP in a given window # Arguments: # - window => Is the chat window widget (.msg_n - Where n is an integer) proc GetInDisplayPictureFrame { window } { @@ -793,7 +793,7 @@ ::ChatWindow::TopUpdate $chatid - if { [winfo exists $win_name.f.out.f.dps] } { + if { [winfo exists [GetOutDisplayPicturesFrame $win_name]] } { ::amsn::ShowOrHidePicture ::amsn::ShowOrHideTopPicture ::amsn::UpdatePictures $win_name @@ -2015,51 +2015,67 @@ proc CreateDisplayPicturesFrame { w fr } { - # Pack them + # Pack them if { [::config::getKey old_dpframe 0] == 0 } { - # Name our widgets - set f $fr.f - set frame $f.dps - set voip $f.voip - set showpic $frame.showpic - - # Create them - frame $f -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + + # Create them + frame $fr.f -class Amsn -borderwidth 0 -padx 0 -pady 0 \ -relief solid -background [::skin::getKey chatwindowbg] - frame $frame -class Amsn -borderwidth 0 -padx 0 -pady 0 \ - -relief solid -background [::skin::getKey chatwindowbg] - frame $voip -class Amsn -borderwidth 0 -padx 0 -pady 0 \ - -relief solid -background [::skin::getKey chatwindowbg] - - ScrolledWindow $frame.sw -scrollbar vertical -auto vertical -borderwidth 0 - ScrollableFrame $frame.sw.sf -width 0 -bg [::skin::getKey chatwindowbg] - $frame.sw setwidget $frame.sw.sf - - label $showpic -bd 0 -padx 0 -pady 0 -image [::skin::loadPixmap imgshow] \ - -bg [::skin::getKey chatwindowbg] -highlightthickness 0 -font splainf \ - -highlightbackground [::skin::getKey chatwindowbg] -activebackground [::skin::getKey chatwindowbg] - bind $showpic <Enter> "$showpic configure -image [::skin::loadPixmap imgshow_hover]" - bind $showpic <Leave> "$showpic configure -image [::skin::loadPixmap imgshow]" - set_balloon $showpic [trans showdisplaypic] + ScrolledWindow $fr.f.sw -scrollbar vertical -auto vertical -borderwidth 0 + ScrollableFrame $fr.f.sw.sf -width 0 -bg [::skin::getKey chatwindowbg] + $fr.f.sw setwidget $fr.f.sw.sf + + # Name our widgets + set f [$fr.f.sw.sf getframe] + set dpsframe $f.dps + set images $dpsframe.imgs + set voip $f.voip + set showpic $dpsframe.showpic - pack $frame -side top -padx 0 -pady 0 -anchor ne - pack $voip -side bottom -before $frame -padx 0 -pady 0 -anchor ne - pack $frame.sw -side left -expand false -anchor ne + frame $dpsframe -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + -relief solid -background [::skin::getKey chatwindowbg] + frame $voip -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + -relief solid -background [::skin::getKey chatwindowbg] + frame $images -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + -relief solid -background [::skin::getKey chatwindowbg] + + + label $showpic -bd 0 -padx 0 -pady 0 -image [::skin::loadPixmap imgshow] \ + -bg [::skin::getKey chatwindowbg] -highlightthickness 0 -font splainf \ + -highlightbackground [::skin::getKey chatwindowbg] -activebackground [::skin::getKey chatwindowbg] + bind $showpic <Enter> "$showpic configure -image [::skin::loadPixmap imgshow_hover]" + bind $showpic <Leave> "$showpic configure -image [::skin::loadPixmap imgshow]" + set_balloon $showpic [trans showdisplaypic] + + pack $fr.f.sw -fill y -anchor ne + pack $dpsframe -side top -padx 0 -pady 0 -anchor ne + pack $voip -side bottom -padx 0 -pady 0 -anchor ne + pack $images -side left -anchor ne pack $showpic -side right -anchor ne bind $showpic <<Button1>> [list ::amsn::ToggleShowTopPicture] ::amsn::ShowOrHideTopPicture } else { - set f $fr.f + # Create them + frame $fr.f -class Amsn -borderwidth 0 -padx 0 -pady 0 \ + -relief solid -background [::skin::getKey chatwindowbg] + ScrolledWindow $fr.f.sw -scrollbar vertical -auto vertical -borderwidth 0 + ScrollableFrame $fr.f.sw.sf -width 0 -bg [::skin::getKey chatwindowbg] + $fr.f.sw setwidget $fr.f.sw.sf + + # Name our widgets + set f [$fr.f.sw.sf getframe] set voip $f.voip - frame $f -class Amsn -borderwidth 0 -padx 0 -pady 0 \ - -relief solid -background [::skin::getKey chatwindowbg] + frame $voip -class Amsn -borderwidth 0 -padx 0 -pady 0 \ -relief solid -background [::skin::getKey chatwindowbg] + + pack $fr.f.sw -fill y -anchor ne pack $voip -side bottom -padx 0 -pady 0 -anchor ne } - return $f + return $fr.f + } #pasteToInput -- text pasted in output window goes to input window @@ -2475,10 +2491,10 @@ proc AddVoipControls {chatid {sip ""} {callid ""}} { if { [OnMac] } { return; } - set window [::ChatWindow::For $chatid] + set win_name [::ChatWindow::For $chatid] - set frame_in [GetInFrame $window].f.voip - set frame_out [GetOutFrame $window].f.voip + set frame_in [GetInFrame $win_name].f.voip + set frame_out [GetOutDisplayPicturesFrame $win_name].voip status_log "Creating CW Voip controls" scale $frame_in.volume -label "Volume" -from 0.0 -to 1.0 \ @@ -2511,6 +2527,11 @@ pack $frame_out.volume $frame_out.amplifier $frame_out.mute $frame_out.hangup \ -side top -padx 0 -pady 0 -expand true -fill x -anchor nw + #Redraw the frames correctly + ::amsn::ShowOrHidePicture + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name].dps] } { + ::amsn::ShowOrHideTopPicture + } } @@ -2520,7 +2541,7 @@ set window [::ChatWindow::For $chatid] set frame_in [GetInFrame $window].f.voip - set frame_out [GetOutFrame $window].f.voip + set frame_out [GetOutDisplayPicturesFrame $window].voip status_log "Updating CW Voip controls" @@ -2566,10 +2587,10 @@ proc RemoveVoipControls {chatid} { if { [OnMac] } { return; } - set window [::ChatWindow::For $chatid] + set win_name [::ChatWindow::For $chatid] - set frame_in [GetInFrame $window].f.voip - set frame_out [GetOutFrame $window].f.voip + set frame_in [GetInFrame $win_name].f.voip + set frame_out [GetOutDisplayPicturesFrame $win_name].voip status_log "Removing CW Voip controls" @@ -2589,6 +2610,15 @@ unset ::ChatWindow::voip_amplification_out unset ::ChatWindow::voip_volume_out } + + $frame_in configure -height 0 + $frame_out configure -height 0 + + #Redraw the frames correctly + ::amsn::ShowOrHidePicture + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name].dps] } { + ::amsn::ShowOrHideTopPicture + } } proc MuteIn {w } { @@ -4464,7 +4494,7 @@ ::ChatWindow::TopUpdate $chatid set usr_name [lindex [::MSN::usersInChat $chatid] 0] - if { [winfo exists $win_name.f.out.f.dps]} { + if { [winfo exists [$win_name.f.out.sw.sf getframe]]} { ::amsn::ShowOrHidePicture ::amsn::ShowOrHideTopPicture ::amsn::UpdatePictures $win_name Modified: trunk/amsn/gui.tcl =================================================================== --- trunk/amsn/gui.tcl 2008-12-19 19:45:47 UTC (rev 10807) +++ trunk/amsn/gui.tcl 2008-12-21 10:36:44 UTC (rev 10808) @@ -2250,7 +2250,7 @@ ::ChatWindow::Status [ ::ChatWindow::For $chatid ] $statusmsg minijoins ::ChatWindow::TopUpdate $chatid - if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name]] } { + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name].dps] } { ::amsn::ShowOrHidePicture ::amsn::ShowOrHideTopPicture ::amsn::UpdatePictures $win_name @@ -2316,7 +2316,7 @@ set icon minileaves } - if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name]] } { + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name].dps] } { ::amsn::UpdatePictures $win_name } else { #Check if the image that is currently showing is @@ -2538,15 +2538,15 @@ foreach chat $chatids { set win [::ChatWindow::For $chat] - if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win]]} { - ::amsn::UpdatePictures $win + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win].dps]} { + ::amsn::UpdatePictures $win } } } - proc UpdatePictures { win } { - set frame [::ChatWindow::GetOutDisplayPicturesFrame $win] - set images [$frame.sw.sf getframe] + proc UpdatePictures { win } { + set f [::ChatWindow::GetOutDisplayPicturesFrame $win] + set images $f.dps.imgs set chatid [::ChatWindow::Name $win] set users [::MSN::usersInChat $chatid] @@ -2596,7 +2596,22 @@ incr idx } - $frame.sw.sf configure -width [expr {$max_width + (2 * [::skin::getKey chat_dp_border])}] + + #compute the size ouf the frame + if {[::config::getKey ShowTopPicture 0] == 1 } { + 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 [::ChatWindow::GetOutDisplayPicturesFrame $win]] configure -width $width } proc HidePicture { win } { @@ -2621,7 +2636,7 @@ if { $win != 0 } { if { [::config::getKey showdisplaypic 1] == 1} { - if {[winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win]] } { + 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] "" @@ -2650,7 +2665,7 @@ set win [::ChatWindow::For $chat] if { $win != 0 } { - if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win]] } { + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win].dps] } { if { [::config::getKey ShowTopPicture 1] == 1} { ShowTopPicture $win } else { @@ -2664,16 +2679,23 @@ proc ShowTopPicture {win } { - set frame [::ChatWindow::GetOutDisplayPicturesFrame $win] + set f [::ChatWindow::GetOutDisplayPicturesFrame $win] + set frame $f.dps set scrolling [::ChatWindow::getScrolling [::ChatWindow::GetOutText $win]] + pack $frame.imgs -side left -expand false -anchor ne - pack $frame.sw -side left -fill y -expand false -anchor ne - $frame.showpic configure -image [::skin::loadPixmap imghide] bind $frame.showpic <Enter> [list $frame.showpic configure -image [::skin::loadPixmap imghide_hover]] bind $frame.showpic <Leave> [list $frame.showpic configure -image [::skin::loadPixmap imghide]] change_balloon $frame.showpic [trans hidedisplaypic] + #UGLY: + set width [expr {96 + (2 * [::skin::getKey chat_dp_border]+[image width [::skin::loadPixmap imghide]])}] + if {[winfo exists $f.voip.volume] && $width <100} { + set width 100 + } + [winfo parent $f] configure -width $width + if { $scrolling } { update idletasks ::ChatWindow::Scroll [::ChatWindow::GetOutText $win] @@ -2681,10 +2703,12 @@ } proc HideTopPicture { win } { - set frame [::ChatWindow::GetOutDisplayPicturesFrame $win] + set f [::ChatWindow::GetOutDisplayPicturesFrame $win] + set frame $f.dps + pack forget $frame.imgs - pack forget $frame.sw + #Change here to change the icon, instead of text $frame.showpic configure -image [::skin::loadPixmap imgshow] bind $frame.showpic <Enter> [list $frame.showpic configure -image [::skin::loadPixmap imgshow_hover]] @@ -2692,6 +2716,12 @@ change_balloon $frame.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 + } #/////////////////////////////////////////////////////////////////////////////// @@ -3686,7 +3716,7 @@ set evPar(usr_name) $user ::plugins::PostEvent new_conversation evPar - if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name]] } { + if { [winfo exists [::ChatWindow::GetOutDisplayPicturesFrame $win_name].dps] } { ::amsn::ShowOrHidePicture ::amsn::ShowOrHideTopPicture ::amsn::UpdatePictures $win_name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |