[Tkabber-dev] r783 - in trunk/tkabber: . plugins/richtext

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Nov 4 21:51:37 MSK 2006


Author: sergei
Date: 2006-11-04 21:51:30 +0300 (Sat, 04 Nov 2006)
New Revision: 783

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/richtext/emoticons.tcl
   trunk/tkabber/plugins/richtext/stylecodes.tcl
   trunk/tkabber/plugins/richtext/urls.tcl
Log:
	* plugins/richtext/emoticons.tcl, plugins/richtext/stylecodes.tcl,
	  plugins/richtext/urls.tcl: Removed 'enable' options, added
	  all customize groups to Chat group. Changed emoticons theme
	  definition: now options(theme) should be set to the name of
	  theme directory. Theme names are used only for labels in
	  customize option menu.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-11-04 18:06:29 UTC (rev 782)
+++ trunk/tkabber/ChangeLog	2006-11-04 18:51:30 UTC (rev 783)
@@ -1,7 +1,14 @@
 2006-11-04  Sergei Golovan  <sgolovan at nes.ru>
 
+	* plugins/richtext/emoticons.tcl, plugins/richtext/stylecodes.tcl,
+	  plugins/richtext/urls.tcl: Removed 'enable' options, added
+	  all customize groups to Chat group. Changed emoticons theme
+	  definition: now options(theme) should be set to the name of
+	  theme directory. Theme names are used only for labels in
+	  customize option menu.
+
 	* plugins/richtext/emoticons.tcl: Fixed processing of 'None'
-	  emoticon theme (theme without images at all).
+	  emoticon theme (theme with no images at all).
 
 	* plugins/richtext/urls.tcl, chats.tcl: Fixed URL highlighting
 	  when mouse pointer is over the URL (thanks to Konstantin

Modified: trunk/tkabber/plugins/richtext/emoticons.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/emoticons.tcl	2006-11-04 18:06:29 UTC (rev 782)
+++ trunk/tkabber/plugins/richtext/emoticons.tcl	2006-11-04 18:51:30 UTC (rev 783)
@@ -20,13 +20,9 @@
 		       used to represent user's emotion. They are\
 		       typed in as special mnemonics like :)\
 		       or can be inserted using menu."]\
-	-group {Rich Text}
+	-group {Rich Text} \
+	-group Chat
 
-    ::custom::defvar options(enabled) 1 \
-	[::msgcat::mc "Enable handling of emoticons."] \
-	-type boolean -group Emoticons \
-	-command [namespace current]::on_state_changed
-
     set options(no_theme) [::msgcat::mc "None"]
     set options(active_theme) $options(no_theme)
 	
@@ -524,36 +520,15 @@
     return 0
 }
 
-proc emoticons::load_theme {theme} {
-    variable themes
-
-    if {![info exists themes($theme)]} {
-	load_dir ""
-    } else {
-	load_dir $themes($theme)
-    }
-}
-
 # Gets called when options(theme) changes
 proc emoticons::on_theme_changed {args} {
     variable options
 
     if {$options(active_theme) != $options(theme)} {
-	load_theme $options(theme)
+	load_dir $options(theme)
     }
 }
 
-# Gets called when the enabled/disabled state of emoticons subsystem changes
-proc emoticons::on_state_changed {args} {
-    variable options
-
-    if {$options(enabled)} {
-	enable_subsystem
-    } else {
-	disable_subsystem
-    }
-}
-
 proc emoticons::find_themes {} {
     variable options
     variable themes
@@ -570,7 +545,7 @@
     }
 
     foreach theme $theme_names {
-	lappend values $theme $theme
+	lappend values $themes($theme) $theme
     }
 
     set values [linsert $values 0 "" $options(no_theme)]
@@ -581,7 +556,7 @@
     } else {
 	set idx [lsearch -sorted $theme_names Default]
 	if {$idx >= 0} {
-	    set theme [lindex $theme_names $idx]
+	    set theme [lindex $theme_names [expr {$idx - 1}]]
 	} else {
 	    set theme ""
 	}
@@ -635,7 +610,7 @@
 }
 
 namespace eval emoticons {
-    ::hook::add finload_hook [namespace current]::on_state_changed
+    ::hook::add postload_hook [namespace current]::enable_subsystem
 
     ::hook::add open_chat_post_hook [namespace current]::setup_bindings
 

Modified: trunk/tkabber/plugins/richtext/stylecodes.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/stylecodes.tcl	2006-11-04 18:06:29 UTC (rev 782)
+++ trunk/tkabber/plugins/richtext/stylecodes.tcl	2006-11-04 18:51:30 UTC (rev 783)
@@ -9,15 +9,11 @@
 		       used to emphasize parts of the text by setting them\
 		       with boldface, italics or underlined styles,\
 		       or as combinations of these."] \
-	-group {Rich Text}
+	-group {Rich Text} \
+	-group Chat
 
-    ::custom::defvar options(enabled) 1 \
-	[::msgcat::mc "Enable processing of stylecodes."] \
-	-type boolean -group Stylecodes \
-	-command [namespace current]::change_entity_state
-
     ::custom::defvar options(emphasize) 1 \
-	[::msgcat::mc "Emphasize stylecoded messages using fonts."] \
+	[::msgcat::mc "Emphasize stylecoded messages using different fonts."] \
 	-type boolean -group Stylecodes \
 	-command [namespace current]::toggle_codes
 }
@@ -217,12 +213,6 @@
     }
 }
 
-proc stylecodes::change_entity_state {args} {
-    variable options
-
-    ::richtext::entity_state stylecode $options(enabled)
-}
-
 namespace eval stylecodes {
     ::richtext::register_entity stylecode \
 	-configurator [namespace current]::configure_richtext_widget \
@@ -230,6 +220,6 @@
 	-renderer [namespace current]::render_stylecode \
 	-parser-priority 70
 
-    change_entity_state ;# Customize won't do this by itself
+    ::richtext::entity_state stylecode 1
 }
 

Modified: trunk/tkabber/plugins/richtext/urls.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/urls.tcl	2006-11-04 18:06:29 UTC (rev 782)
+++ trunk/tkabber/plugins/richtext/urls.tcl	2006-11-04 18:51:30 UTC (rev 783)
@@ -13,13 +13,6 @@
     variable options
     variable urlid 0
 
-    ::custom::defgroup URL [::msgcat::mc "URL handling options."] -group {Rich Text}
-
-    ::custom::defvar options(enabled) 1 \
-	[::msgcat::mc "Enable special URL processing."] \
-	-type boolean -group URL \
-	-command [namespace current]::change_entity_state
-
     # TODO add user:pass@ match
     # TODO sync TLDs with http://www.icann.org/tlds/app-index.htm
     set url_regexp {
@@ -223,16 +216,6 @@
     config_url $w url -command [list [namespace current]::browse_url %W %x %y]
 }
 
-
-
-proc urls::change_entity_state {args} {
-    variable options
-
-    ::richtext::entity_state url $options(enabled)
-}
-
-
-
 namespace eval urls {
     ::richtext::register_entity url \
 	-configurator [namespace current]::configure_richtext_widget \
@@ -240,6 +223,6 @@
 	-renderer [namespace current]::render_url \
 	-parser-priority 60
 
-    change_entity_state ;# Customize won't do this
+    ::richtext::entity_state url 1
 }
 



More information about the Tkabber-dev mailing list