[Tkabber-dev] r415 - in trunk/plugins: . clienticons clienticons/msgs tabbedcon tabbedcon/msgs tabbedcon/pixmaps

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Oct 5 00:36:45 MSD 2010


Author: ancestor
Date: 2010-10-05 00:36:45 +0400 (Tue, 05 Oct 2010)
New Revision: 415

Added:
   trunk/plugins/tabbedcon/
   trunk/plugins/tabbedcon/INSTALL
   trunk/plugins/tabbedcon/license.terms
   trunk/plugins/tabbedcon/msgs/
   trunk/plugins/tabbedcon/msgs/ru.msg
   trunk/plugins/tabbedcon/pixmaps/
   trunk/plugins/tabbedcon/pixmaps/console16.png
   trunk/plugins/tabbedcon/pixmaps/console22.png
   trunk/plugins/tabbedcon/tabbedcon.tcl
Modified:
   trunk/plugins/clienticons/clienticons.tcl
   trunk/plugins/clienticons/msgs/ru.msg
Log:
1) New plugin tabbedcon.tcl, which attaches tkCon window to tab frame (tab interface only).
2) Fixed bad char in clienticons.tcl.


Modified: trunk/plugins/clienticons/clienticons.tcl
===================================================================
--- trunk/plugins/clienticons/clienticons.tcl	2010-10-01 13:55:39 UTC (rev 414)
+++ trunk/plugins/clienticons/clienticons.tcl	2010-10-04 20:36:45 UTC (rev 415)
@@ -16,7 +16,7 @@
         ::plugins::register clienticons \
             -namespace [namespace current] \
             -source [info script] \
-            -description [::msgcat::mc "Сlient icons."] \
+            -description [::msgcat::mc "Client icons."] \
             -loadcommand [namespace code load] \
             -unloadcommand [namespace code unload]
         return

Modified: trunk/plugins/clienticons/msgs/ru.msg
===================================================================
--- trunk/plugins/clienticons/msgs/ru.msg	2010-10-01 13:55:39 UTC (rev 414)
+++ trunk/plugins/clienticons/msgs/ru.msg	2010-10-04 20:36:45 UTC (rev 415)
@@ -1,4 +1,4 @@
-::msgcat::mcset ru "Сlient icons." "Показ иконок клиентов."
+::msgcat::mcset ru "Client icons." "Показ иконок клиентов."
 ::msgcat::mcset ru "Client icons options." "Настройки иконок клиентов."
 ::msgcat::mcset ru "Show affiliation icons (only groupchats)." "Показывать иконки рангов и ролей в конференциях."
 ::msgcat::mcset ru "Show client icons." "Показывать иконки клиентов."
\ No newline at end of file

Added: trunk/plugins/tabbedcon/INSTALL
===================================================================
--- trunk/plugins/tabbedcon/INSTALL	                        (rev 0)
+++ trunk/plugins/tabbedcon/INSTALL	2010-10-04 20:36:45 UTC (rev 415)
@@ -0,0 +1,13 @@
+To install this plugin just place its directory (tabbedcon) 
+into Tkabber's plugin directory. Most likely it is either 
+~/.tkabber/plugins
+or
+X:\Documents and Settings\YourUser\Application Data\Tkabber\plugins
+where X: is the drive your system is installed on.
+
+So, you'll have something like this:
+~/.tkabber/plugins/highlightex/tabbedcon.tcl
+or
+X:\Documents and Settings\YourUser\Application Data\Tkabber\plugins\highlightex\tabbedcon.tcl
+
+After that you have to restart Tkabber.

Added: trunk/plugins/tabbedcon/license.terms
===================================================================
--- trunk/plugins/tabbedcon/license.terms	                        (rev 0)
+++ trunk/plugins/tabbedcon/license.terms	2010-10-04 20:36:45 UTC (rev 415)
@@ -0,0 +1,19 @@
+Copyright (c) 2010 ancestor <xmpp:ancestor at jabber.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.

Added: trunk/plugins/tabbedcon/msgs/ru.msg
===================================================================
--- trunk/plugins/tabbedcon/msgs/ru.msg	                        (rev 0)
+++ trunk/plugins/tabbedcon/msgs/ru.msg	2010-10-04 20:36:45 UTC (rev 415)
@@ -0,0 +1,3 @@
+::msgcat::mcset ru "Console" "Консоль"
+::msgcat::mcset ru "Detach" "Отсоединить"
+::msgcat::mcset ru "Clear" "Очистить"
\ No newline at end of file

Added: trunk/plugins/tabbedcon/pixmaps/console16.png
===================================================================
(Binary files differ)


Property changes on: trunk/plugins/tabbedcon/pixmaps/console16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/plugins/tabbedcon/pixmaps/console22.png
===================================================================
(Binary files differ)


Property changes on: trunk/plugins/tabbedcon/pixmaps/console22.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/plugins/tabbedcon/tabbedcon.tcl
===================================================================
--- trunk/plugins/tabbedcon/tabbedcon.tcl	                        (rev 0)
+++ trunk/plugins/tabbedcon/tabbedcon.tcl	2010-10-04 20:36:45 UTC (rev 415)
@@ -0,0 +1,210 @@
+# Copyright (c) 2010 ancestor <xmpp: ancestor at jabber.org>
+# Tabbed tkCon plugin
+# This plugin contains some graphics of KDE 3.5.8 <http://kde.org>
+
+namespace eval tabbedcon {
+    package require tkcon
+
+    variable tbicon
+    variable tabico
+    variable contab
+
+    ::msgcat::mcload [file join [file dirname [info script]] msgs]
+
+    set tbicon "[file dirname [info script]]/pixmaps/console22.png"
+    set tabico "[file dirname [info script]]/pixmaps/console16.png"
+
+    hook::add finload_hook [namespace current]::replace_tkcon_menu_func 35
+}
+
+########################################################################################
+
+proc tabbedcon::replace_tkcon_menu_func {} {
+    if {!$::usetabbar} {
+        return
+    }
+
+    variable tbicon
+    variable tabico
+
+    catch {
+        package require Img
+        
+        image create photo plugins/tabbedcon/toolbar -file $tbicon
+        
+        ::ifacetk::add_toolbar_button plugins/tabbedcon/toolbar \
+            [namespace current]::show_tabbed_console \
+            [::msgcat::mc "Console"]
+        
+        image create photo plugins/tabbedcon/tabbar -file $tabico
+    }
+
+    rename ::plugins::tkcon::add_tkcon_to_tkabber_menu ::plugins::tkcon::add_tkcon_to_tkabber_menu_old
+
+    proc ::plugins::tkcon::add_tkcon_to_tkabber_menu {args} {
+        set menu [.mainframe getmenu debug]
+        
+        $menu add command -label [::msgcat::mc "Show TkCon console"] \
+            -command ::plugins::tabbedcon::show_tabbed_console
+    }
+}
+
+proc tabbedcon::set_con_focus {} {
+    if {[info exists ::tkcon::PRIV(curtab)]} {
+        focus $::tkcon::PRIV(curtab)
+    }
+}
+
+proc tabbedcon::get_tabs_compound {} {
+    set compound none
+
+    foreach tab [.nb pages] {
+        set compound [lindex [.nb.b:$tab configure -compound] end]
+        
+        if {$compound != "none"} {
+            return $compound
+        }
+    }
+
+    return $compound
+}
+
+proc tabbedcon::reconfig_menu {m} {
+    variable contab
+
+    foreach mni {{Main Console} {New Console} \
+                {New Tab} {Delete Tab}} {
+        
+        set midx [$m index $mni]
+        
+        $m entryconfigure $midx -state disabled
+    }
+
+    set midx [$m index {Close Console}]
+
+    $m entryconfigure $midx -command [list ::ifacetk::destroy_tab $contab]
+}
+
+proc tabbedcon::restore_menu {m} {
+    foreach mni {{New Console} {New Tab}} {
+        set midx [$m index $mni]
+        
+        $m entryconfigure $midx -state normal
+    }
+
+    set midx [$m index {Close Console}]
+
+    $m entryconfigure $midx -command [list ::tkcon::Destroy]
+}
+
+proc tabbedcon::create_pseudo_menu {frm} {
+    foreach mnl [winfo children .tkcon.mbar] {
+        switch -glob -- $mnl {
+            *.pop -
+            *.file -
+            *.context   {continue}
+        }
+        
+        set mnn [winfo name $mnl]
+        
+        set m $frm.$mnn.menu
+        
+        set mnb [menubutton $frm.$mnn \
+            -text [string totitle $mnn] \
+            -anchor nw \
+            -menu $m]
+            
+        $mnl clone $m
+        
+        if {$mnn == "console"} {
+            reconfig_menu $m
+        }
+        
+        pack $mnb -side left
+    }
+}
+
+proc tabbedcon::show_tabbed_console {} {
+    variable contab
+
+    set w .tbcon
+    
+    if {[winfo exists $w]} {
+        .nb activate $contab
+        return
+    }
+
+    tkcon hide
+
+    add_win $w -title [::msgcat::mc "Console"] \
+	   -tabtitle [::msgcat::mc "Console"] \
+	   -class TabbedCon \
+       -raisecmd [list [namespace current]::set_con_focus] \
+	   -raise 1
+
+    set contab [lindex [.nb pages] end]
+
+    set tabimg plugins/tabbedcon/tabbar
+
+    set compound [get_tabs_compound]
+
+    if {[lsearch [image names] $tabimg] != -1 && $compound != "none"} {
+        .nb.b:$contab configure -image plugins/tabbedcon/tabbar \
+            -compound $compound
+    }
+
+    set mf [frame $w.mf]
+    pack $mf -side top -anchor w -fill x -pady 2
+
+    set tools [frame $w.tools]
+    pack $tools -side bottom -anchor nw -fill x -pady 5
+
+    button $tools.detach -text [::msgcat::mc "Detach"] \
+        -command [namespace current]::detach_console
+        
+    pack $tools.detach -side left -anchor w
+
+    button $tools.clear -text [::msgcat::mc "Clear"] \
+        -command {clear; ::tkcon::Prompt}
+        
+    pack $tools.clear -side left -anchor w
+
+    if {![info exists ::tkcon::PRIV(root)]} {
+        set ::tkcon::PRIV(showOnStartup) 0
+        set ::tkcon::PRIV(protocol) {tkcon hide}
+        set ::tkcon::PRIV(root) .tkcon
+        set ::tkcon::OPT(exec) ""
+    }
+
+    if {![winfo exists $::tkcon::PRIV(root)]} {
+        ::tkcon::Init
+    }
+
+    create_pseudo_menu $mf
+
+    set nt [::tkcon::InitTab $w]
+
+    pack $nt -fill both -expand yes
+
+    ::tkcon::GotoTab $nt
+
+    set sy [scrollbar $nt.sy -takefocus 0 -command [list $nt yview]]
+
+    $nt configure -yscrollcommand [list $sy set]
+
+    pack $sy -side right -fill both
+
+    bind $nt <Destroy> {
+        ::tkcon::DeleteTab $::tkcon::PRIV(curtab)
+    }
+}
+
+proc tabbedcon::detach_console {} {
+    set atab [.nb raise]
+
+    ::ifacetk::destroy_tab $atab
+
+    restore_menu .tkcon.mbar.console
+    
+    tkcon show
+}
\ No newline at end of file



More information about the Tkabber-dev mailing list