4
4
#########################################
6
::Version::setSubversionId {$Id: chatwindow.tcl 11713 2009-10-19 18:52:33Z billiob $}
6
::Version::setSubversionId {$Id: chatwindow.tcl 11981 2010-03-07 20:26:51Z lephilousophe $}
8
8
package require framec
9
9
package require scalable-bg
580
proc TrayBlinkStart { window } {
581
variable trayblinkwindows
582
if { [::config::getKey blinktray] == 0 } {
583
if {[llength $trayblinkwindows] > 0} {
584
set trayblinkwindows [list]
585
after cancel ::ChatWindow::TrayBlink 0
586
after cancel ::ChatWindow::TrayBlink 1
587
statusicon_proc [::MSN::myStatusIs]
591
set idx [lsearch [set trayblinkwindows] $window]
593
lappend trayblinkwindows $window
594
after cancel ::ChatWindow::TrayBlink 0
595
after cancel ::ChatWindow::TrayBlink 1
596
::ChatWindow::TrayBlink 1
600
proc TrayBlinkStop { window } {
601
variable trayblinkwindows
602
set idx [lsearch [set trayblinkwindows] $window]
604
set trayblinkwindows [lreplace [set trayblinkwindows] $idx $idx]
605
if { [llength $trayblinkwindows] == 0 } {
606
after cancel ::ChatWindow::TrayBlink 0
607
after cancel ::ChatWindow::TrayBlink 1
608
statusicon_proc [::MSN::myStatusIs]
613
proc TrayBlink { blink } {
614
variable trayblinkwindows
615
if { [::config::getKey blinktray] == 0 } {
619
statusicon_proc [::MSN::myStatusIs]
620
after [::skin::getKey trayblink_delay] ::ChatWindow::TrayBlink 1
622
statusicon_blink_proc [::MSN::myStatusIs]
623
after [::skin::getKey trayblink_delay] ::ChatWindow::TrayBlink 0
625
if { [llength $trayblinkwindows] == 0 } {
626
after cancel ::ChatWindow::TrayBlink 0
627
after cancel ::ChatWindow::TrayBlink 1
628
statusicon_proc [::MSN::myStatusIs]
575
632
proc MacKeepBouncing { } {
576
633
if {[catch {::carbon::notification "" 1} res]} {
694
756
# so we do it in a catch statement, if it fails. Then load the extension before
695
757
# calling winflash. If this one or the first one were successful, we add a bind
696
758
# on FocusIn to call the winflash with the -state 0 option to disable it and we return.
759
TrayBlinkStart $window
698
761
if { [catch {winflash $window -count 5} ] } {
700
763
package require winflash
701
764
winflash $window -count 5
703
bind $window <FocusIn> "catch \" winflash $window -state 0\"; bind $window <FocusIn> \"\""
766
bind $window <FocusIn> [list ::ChatWindow::GotFocusUnflash ${window}]
707
bind $window <FocusIn> "catch \" winflash $window -state 0\"; bind $window <FocusIn> \"\""
770
bind $window <FocusIn> [list ::ChatWindow::GotFocusUnflash ${window}]
710
773
} elseif { [OnLinux] } {
714
777
package require linflash
717
bind $window <FocusIn> "catch \" linunflash $window \"; bind $window <FocusIn> \"\""
780
bind $window <FocusIn> [list ::ChatWindow::GotFocusUnflash ${window}]
721
784
# in case it didn't work, but we were able to set the 'urgency'
722
785
# hint, we must unset it even if it failed,
723
786
# but still fallback to the flickering of the title.
724
bind $window <FocusIn> "catch \" linunflash $window \"; bind $window <FocusIn> \"\""
787
bind $window <FocusIn> [list ::ChatWindow::GotFocusUnflash ${window}]
727
bind $window <FocusIn> "catch \" linunflash $window \"; bind $window <FocusIn> \"\""
790
bind $window <FocusIn> [list ::ChatWindow::GotFocusUnflash ${window}]
730
793
} elseif { [OnMac] } {
748
811
set ::ChatWindow::new_message_on(${window}) "flicker"
752
814
catch {wm title ${window} "$::ChatWindow::titles($window)"} res
753
815
catch {unset ::ChatWindow::new_message_on(${window})}
755
817
MacBounceDone $window
819
TrayBlinkStop $window
759
822
#///////////////////////////////////////////////////////////////////////////////
789
852
MacBounceDone $window
854
TrayBlinkStop $window
793
857
#///////////////////////////////////////////////////////////////////////////////
859
proc GotFocusUnflash { window } {
860
bind ${window} <FocusIn> ""
862
catch { linunflash $window }
864
catch { winflash $window -state 0 }
866
TrayBlinkStop $window
796
869
#///////////////////////////////////////////////////////////////////////////////
797
870
# ::ChatWindow::MacPosition
1686
1759
$actionsmenu add command -label "[trans sendcam]..." \
1687
1760
-command "::amsn::ShowChatList \"[trans sendcam]\" \[::ChatWindow::getCurrentTab $w\] ::MSNCAM::SendInviteQueue"
1690
$actionsmenu add command -label "[trans sendsip]..." \
1691
-command "::amsn::ShowChatList \"[trans sendsip]\" \[::ChatWindow::getCurrentTab $w\] \"::amsn::SIPCallInviteUser 0\""
1693
$actionsmenu add command -label "[trans sendvideosip]..." \
1694
-command "::amsn::ShowChatList \"[trans sendvideosip]\" \[::ChatWindow::getCurrentTab $w\] \"::amsn::SIPCallInviteUser 1\""
1764
$actionsmenu add command -label "[trans sendsip]..." \
1765
-command "::amsn::ShowChatList \"[trans sendsip]\" \[::ChatWindow::getCurrentTab $w\] \"::amsn::SIPCallInviteUser 0\""
1767
$actionsmenu add command -label "[trans sendvideosip]..." \
1768
-command "::amsn::ShowChatList \"[trans sendvideosip]\" \[::ChatWindow::getCurrentTab $w\] \"::amsn::SIPCallInviteUser 1\""
1697
1771
$actionsmenu add separator
2401
2475
set evPar(bottomleft) [$input getinnerframe]
2402
2476
::plugins::PostEvent chatsendbutton evPar
2404
# Drag and Drop file sending
2405
if {[catch {::dnd bindtarget [::ChatWindow::GetInputText $w] Files <Drop> "fileDropHandler %D sendfile $w"} res ]} {
2406
status_log "dnd error: $res"
2408
#::dnd bindtarget [::ChatWindow::GetInputText $w] UniformResourceLocator <Drop> "%W insert end %D"
2409
if {[catch {::dnd bindtarget [::ChatWindow::GetInputText $w] Text <Drop> {%W insert end %D}} res ]} {
2410
status_log "dnd error: $res"
2478
set droptarget [::ChatWindow::GetInputText $w]
2479
if {[catch {tkdnd::drop_target register $droptarget *} res]} {
2480
status_log "dnd error: $res"
2482
#bind $droptarget <<Drop>> {puts works}
2483
bind $droptarget <<Drop>> [list ::fileDropHandler %D sendfile $w]
2486
# # Drag and Drop file sending
2487
# if {[catch {::dnd bindtarget [::ChatWindow::GetInputText $w] Files <Drop> "fileDropHandler %D sendfile $w"} res ]} {
2488
# status_log "dnd error: $res"
2490
# #::dnd bindtarget [::ChatWindow::GetInputText $w] UniformResourceLocator <Drop> "%W insert end %D"
2491
# if {[catch {::dnd bindtarget [::ChatWindow::GetInputText $w] Text <Drop> {%W insert end %D}} res ]} {
2492
## status_log "dnd error: $res"
2505
2587
-command "::ChatWindow::webcambuttonAction $w"
2506
2588
set_balloon $webcam "--command--::ChatWindow::SetWebcamText"
2509
button $call -image [::skin::loadPixmap butcall] -relief flat -padx 0 \
2510
-background [::skin::getKey buttonbarbg] -highlightthickness 0 -borderwidth 0\
2511
-highlightbackground [::skin::getKey buttonbarbg] -activebackground [::skin::getKey buttonbarbg]\
2512
-command "::amsn::InviteCallFromCW $w 0"
2513
set_balloon $call "[trans sendsip]"
2516
button $callv -image [::skin::loadPixmap butcallvideo] -relief flat -padx 0 \
2517
-background [::skin::getKey buttonbarbg] -highlightthickness 0 -borderwidth 0\
2518
-highlightbackground [::skin::getKey buttonbarbg] -activebackground [::skin::getKey buttonbarbg]\
2519
-command "::amsn::InviteCallFromCW $w 1"
2520
set_balloon $callv "[trans sendvideosip]"
2593
button $call -image [::skin::loadPixmap butcall] -relief flat -padx 0 \
2594
-background [::skin::getKey buttonbarbg] -highlightthickness 0 -borderwidth 0\
2595
-highlightbackground [::skin::getKey buttonbarbg] -activebackground [::skin::getKey buttonbarbg]\
2596
-command "::amsn::InviteCallFromCW $w 0"
2597
set_balloon $call "[trans sendsip]"
2600
button $callv -image [::skin::loadPixmap butcallvideo] -relief flat -padx 0 \
2601
-background [::skin::getKey buttonbarbg] -highlightthickness 0 -borderwidth 0\
2602
-highlightbackground [::skin::getKey buttonbarbg] -activebackground [::skin::getKey buttonbarbg]\
2603
-command "::amsn::InviteCallFromCW $w 1"
2604
set_balloon $callv "[trans sendvideosip]"
2524
2608
pack $fontsel $smileys $voice -side left -padx 0 -pady 0
2525
pack $block $webcam $sendfile $invite $call $callv -side right -padx 0 -pady 0
2610
pack $block $webcam $sendfile $invite $call $callv -side right -padx 0 -pady 0
2612
pack $block $webcam $sendfile $invite -side right -padx 0 -pady 0
2527
2615
bind $voice <<Button1-Press>> "::ChatWindow::start_voice_clip $w"
2528
2616
bind $voice <<Button1>> "::ChatWindow::stop_and_send_voice_clip $w"
2543
2631
bind $invite <Leave> "$invite configure -image [::skin::loadPixmap butinvite]"
2544
2632
bind $webcam <Enter> "$webcam configure -image [::skin::loadPixmap butwebcam_hover]"
2545
2633
bind $webcam <Leave> "$webcam configure -image [::skin::loadPixmap butwebcam]"
2546
bind $call <Enter> "$call configure -image [::skin::loadPixmap butcall_hover]"
2547
bind $call <Leave> "$call configure -image [::skin::loadPixmap butcall]"
2548
bind $callv <Enter> "$callv configure -image [::skin::loadPixmap butcallvideo_hover]"
2549
bind $callv <Leave> "$callv configure -image [::skin::loadPixmap butcallvideo]"
2636
bind $call <Enter> "$call configure -image [::skin::loadPixmap butcall_hover]"
2637
bind $call <Leave> "$call configure -image [::skin::loadPixmap butcall]"
2638
bind $callv <Enter> "$callv configure -image [::skin::loadPixmap butcallvideo_hover]"
2639
bind $callv <Leave> "$callv configure -image [::skin::loadPixmap butcallvideo]"
2551
2642
#send chatwindowbutton postevent
2552
2643
set evPar(bottom) $buttonsinner
3738
3829
set container [string range $tab 0 [expr {[string last "." $tab] - 1}] ]
3739
3830
set container [string range $container 0 [expr {[string last "." $container] -1}] ]
3741
3834
#if tab is not visible, then we should change the color of the < or > button
3742
3835
#to let know there is an invisible tab flickering (an incoming message)
3743
3836
if { [info exists visibletabs($container)] } {
4053
4146
if { $users == "" || [llength $users] == 1} {
4054
4147
set nick [::abook::getDisplayNick $chatid 1]
4055
4148
if { $nick == "" || [::config::getKey tabtitlenick] == 0 } {
4056
set txt [concat $style [list [list text $tab]]]
4149
set txt [concat $style [list [list text $chatid]]]
4058
4151
set txt [concat $style $nick]
4091
4184
[lsearch [set containerwindows($container)] $win] == -1 } {
4092
4185
status_log "can't switch to a window that doesn't belong to the correct container"
4188
::ChatWindow::TrayBlinkStop $win
4096
4191
#TODO: # Don't switch if tab clicked is already current tab. > 2 used because otherwise windows for new mesages dont appear. this means this is only effective with three or more tabs open. hope someone can find how to fix this.