[Tkabber-dev] r1490 - in trunk/tkabber-plugins: . whiteboard whiteboard/msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Aug 26 14:09:02 MSD 2008


Author: sergei
Date: 2008-08-26 14:09:01 +0400 (Tue, 26 Aug 2008)
New Revision: 1490

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/whiteboard/msgs/ru.msg
   trunk/tkabber-plugins/whiteboard/whiteboard.tcl
Log:
	* whiteboard/whiteboard.tcl: Converted draw actions back to radio
	  buttons (it's too inefficient to use popup menu for them). Transform
	  and remove actions are left in the popup menu.

	* whiteboard/msgs/ru.msg: Updated Russian translation.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2008-08-25 10:51:27 UTC (rev 1489)
+++ trunk/tkabber-plugins/ChangeLog	2008-08-26 10:09:01 UTC (rev 1490)
@@ -1,3 +1,11 @@
+2008-08-26  Sergei Golovan <sgolovan at nes.ru>
+
+	* whiteboard/whiteboard.tcl: Converted draw actions back to radio
+	  buttons (it's too inefficient to use popup menu for them). Transform
+	  and remove actions are left in the popup menu.
+
+	* whiteboard/msgs/ru.msg: Updated Russian translation.
+
 2008-08-08  Sergei Golovan <sgolovan at nes.ru>
 
 	* checkers/checkers.tcl, chess/chess.tcl, renju/renju.tcl,

Modified: trunk/tkabber-plugins/whiteboard/msgs/ru.msg
===================================================================
--- trunk/tkabber-plugins/whiteboard/msgs/ru.msg	2008-08-25 10:51:27 UTC (rev 1489)
+++ trunk/tkabber-plugins/whiteboard/msgs/ru.msg	2008-08-26 10:09:01 UTC (rev 1490)
@@ -6,18 +6,26 @@
 ::msgcat::mcset ru "Enter text" "Введите текст"
 ::msgcat::mcset ru "Fill color" "Цвет заливки"
 ::msgcat::mcset ru "Fill" "Заливать"
+::msgcat::mcset ru "Flip horizontally" "Отразить горизонтально"
+::msgcat::mcset ru "Flip vertically" "Отразить вертикально"
 ::msgcat::mcset ru "FreeHand" "Кривая"
 ::msgcat::mcset ru "Line color" "Цвет линии"
 ::msgcat::mcset ru "Line width: " "Ширина линии: "
-::msgcat::mcset ru "Move" "Переместить"
+::msgcat::mcset ru "Move/Transform" "Перемест./Трансформ."
 ::msgcat::mcset ru "OK" "Продолжить"
 ::msgcat::mcset ru "Polygon" "Многоугольник"
 ::msgcat::mcset ru "PolyLine" "Ломаная"
+::msgcat::mcset ru "Rectangle" "Прямоугольник"
 ::msgcat::mcset ru "Remove" "Удалить"
+::msgcat::mcset ru "Rotate 135\u00b0" "Повернуть на 135\u00b0"
+::msgcat::mcset ru "Rotate 180\u00b0" "Повернуть на 180\u00b0"
+::msgcat::mcset ru "Rotate 45\u00b0" "Повернуть на 45\u00b0"
+::msgcat::mcset ru "Rotate 90\u00b0" "Повернуть на 90\u00b0"
 ::msgcat::mcset ru "Save..." "Сохранить..."
 ::msgcat::mcset ru "Show balloons" "Показывать подск."
 ::msgcat::mcset ru "%s created: %s" "%s создано: %s"
 ::msgcat::mcset ru "%s moved: %s" "%s перемещено: %s"
+::msgcat::mcset ru "%s transformed: %s" "%s трансформировано: %s"
 ::msgcat::mcset ru "%s whiteboard" "%s доска"
 ::msgcat::mcset ru "Text color" "Цвет текста"
 ::msgcat::mcset ru "Text font" "Шрифт текста"

Modified: trunk/tkabber-plugins/whiteboard/whiteboard.tcl
===================================================================
--- trunk/tkabber-plugins/whiteboard/whiteboard.tcl	2008-08-25 10:51:27 UTC (rev 1489)
+++ trunk/tkabber-plugins/whiteboard/whiteboard.tcl	2008-08-26 10:09:01 UTC (rev 1490)
@@ -62,6 +62,50 @@
     set tb [frame $w.tb]
     pack $tb -side left -fill y
 
+    set tbfreehand [radiobutton $w.tb.freehand -text [::msgcat::mc "FreeHand"] \
+			-variable [namespace current]::tool($chatid) \
+			-value freehand \
+			-command [list [namespace current]::freehand_bind \
+				      $c $chatid]]
+
+    set tbpolyline [radiobutton $w.tb.line -text [::msgcat::mc "PolyLine"] \
+			-variable [namespace current]::tool($chatid) \
+			-value polyline \
+			-command [list [namespace current]::line_bind $c $chatid]]
+    
+    set tbrectangle [radiobutton $w.tb.rectangle -text [::msgcat::mc "Rectangle"] \
+			-variable [namespace current]::tool($chatid) \
+			-value rectangle \
+			-command [list [namespace current]::rectangle_bind \
+				      $c $chatid]]
+
+    set tbpolygon [radiobutton $w.tb.polygon -text [::msgcat::mc "Polygon"] \
+			-variable [namespace current]::tool($chatid) \
+			-value polygon \
+			-command [list [namespace current]::polygon_bind \
+				      $c $chatid]]
+
+    set tbcircle [radiobutton $w.tb.circle -text [::msgcat::mc "Circle"] \
+			-variable [namespace current]::tool($chatid) \
+			-value circle \
+			-command [list [namespace current]::circle_bind \
+				      $c $chatid]]
+
+    set tbtext [radiobutton $w.tb.text -text [::msgcat::mc "Text"] \
+		      -variable [namespace current]::tool($chatid) \
+		      -value text \
+		      -command [list [namespace current]::text_bind \
+				    $c $chatid]]
+
+    set tbmove [radiobutton $w.tb.move -text [::msgcat::mc "Move/Transform"] \
+		    -variable [namespace current]::tool($chatid) \
+		    -value move \
+		    -command [list [namespace current]::move_bind \
+				  $c $chatid]]
+
+    pack $tbfreehand $tbpolyline $tbrectangle $tbpolygon $tbcircle $tbtext \
+	 $tbmove -anchor w
+
     button $w.tb.clear -text [::msgcat::mc "Clear"] \
 	-command [list [namespace current]::send_clear $chatid]
     pack $w.tb.clear -side bottom -anchor w -fill x
@@ -141,11 +185,13 @@
     $c bind all <Any-Leave>  \
 	[list [namespace current]::balloon $chatid $c leave  %X %Y]
 
-    reset_bind $c $chatid
-
     trace variable [namespace current]::width($chatid) w \
 	[list [namespace current]::change_width \
 	     $w.tb.color [namespace current]::width($chatid)]
+
+    variable tool
+    set tool($chatid) move
+    move_bind $c $chatid
 }
 
 proc wb::balloon {chatid c action X Y} {
@@ -408,19 +454,6 @@
 
 ###############################################################################
 
-proc wb::reset_bind {c chatid} {
-    bind $c <ButtonPress-1> \
-	 [list [namespace current]::move_b1p [double% $c] [double% $chatid] %x %y]
-    bind $c <B1-Motion> \
-	 [list [namespace current]::move_b1m [double% $c] %x %y]
-    bind $c <ButtonRelease-1> \
-	 [list [namespace current]::move_b1r [double% $c] [double% $chatid]]
-    bind $c <Button-3> \
-	 [list [namespace current]::popup_menu [double% $c] [double% $chatid] %X %Y]
-    bind $c <Motion> {}
-    $c configure -cursor ""
-}
-
 proc wb::popup_menu {c chatid x y} {
     set m .whiteboard_popup_menu
 
@@ -439,45 +472,33 @@
 
     menu $m -tearoff 0
 
-    $m add command -label [::msgcat::mc "FreeHand"] \
-		   -command [list [namespace current]::freehand_bind $c $chatid]
-    $m add command -label [::msgcat::mc "PolyLine"] \
-		   -command [list [namespace current]::line_bind $c $chatid]
-    $m add command -label [::msgcat::mc "Rectangle"] \
-		   -command [list [namespace current]::rectangle_bind $c $chatid]
-    $m add command -label [::msgcat::mc "Circle"] \
-		   -command [list [namespace current]::circle_bind $c $chatid]
-    $m add command -label [::msgcat::mc "Polygon"] \
-		   -command [list [namespace current]::polygon_bind $c $chatid]
-    $m add command -label [::msgcat::mc "Text"] \
-		   -command [list [namespace current]::text_bind $c $chatid]
-
     if {![string equal $id ""]} {
 	set state normal
     } else {
 	set state disabled
     }
 
+    $m add command -label [::msgcat::mc "Flip horizontally"] \
+		   -command [list [namespace current]::flip_h $c $chatid $id] \
+		   -state $state
+    $m add command -label [::msgcat::mc "Flip vertically"] \
+		   -command [list [namespace current]::flip_v $c $chatid $id] \
+		   -state $state
+    $m add command -label [::msgcat::mc "Rotate 45\u00b0"] \
+		   -command [list [namespace current]::rotate $c $chatid $id -45] \
+		   -state $state
+    $m add command -label [::msgcat::mc "Rotate 90\u00b0"] \
+		   -command [list [namespace current]::rotate $c $chatid $id -90] \
+		   -state $state
+    $m add command -label [::msgcat::mc "Rotate 135\u00b0"] \
+		   -command [list [namespace current]::rotate $c $chatid $id -135] \
+		   -state $state
+    $m add command -label [::msgcat::mc "Rotate 180\u00b0"] \
+		   -command [list [namespace current]::rotate $c $chatid $id -180] \
+		   -state $state
+
     $m add separator
 
-    set mm [menu $m.transform -tearoff 0]
-    $mm add command -label [::msgcat::mc "Flip horizontally"] \
-		    -command [list [namespace current]::flip_h $c $chatid $id]
-    $mm add command -label [::msgcat::mc "Flip vertically"] \
-		    -command [list [namespace current]::flip_v $c $chatid $id]
-    $mm add command -label [::msgcat::mc "Rotate 45\u00b0"] \
-		    -command [list [namespace current]::rotate $c $chatid $id -45]
-    $mm add command -label [::msgcat::mc "Rotate 90\u00b0"] \
-		    -command [list [namespace current]::rotate $c $chatid $id -90]
-    $mm add command -label [::msgcat::mc "Rotate 135\u00b0"] \
-		    -command [list [namespace current]::rotate $c $chatid $id -135]
-    $mm add command -label [::msgcat::mc "Rotate 180\u00b0"] \
-		    -command [list [namespace current]::rotate $c $chatid $id -180]
-
-    $m add cascade -label [::msgcat::mc "Transform"] \
-		   -menu $mm \
-		   -state $state
-    $m add separator
     $m add command -label [::msgcat::mc "Remove"] \
 		   -command [list [namespace current]::remove_b1p $c $chatid $id] \
 		   -state $state
@@ -607,8 +628,6 @@
 
 	set line(coords) {}
 	set line(temp) {}
-
-	reset_bind $c $chatid
     }
 }
 
@@ -725,8 +744,6 @@
 	}
 	set polygon(coords) {}
 	set polygon(temp) {}
-
-	reset_bind $c $chatid
     }
 }
 
@@ -806,8 +823,6 @@
         unset rectangle(y1)
         unset rectangle(y2)
         set rectangle(temp) {}
-
-	reset_bind $c $chatid
     }
 }
 
@@ -915,8 +930,6 @@
         unset circle(cx)
         unset circle(cy)
         set circle(temp) {}
-
-	reset_bind $c $chatid
     }
 }
 
@@ -1020,8 +1033,6 @@
 
 	set line(coords) {}
 	set line(temp) {}
-
-	reset_bind $c $chatid
     }
 }
 
@@ -1067,6 +1078,19 @@
 ###############################################################################
 # Move
 
+proc wb::move_bind {c chatid} {
+    bind $c <ButtonPress-1> \
+	 [list [namespace current]::move_b1p [double% $c] [double% $chatid] %x %y]
+    bind $c <B1-Motion> \
+	 [list [namespace current]::move_b1m [double% $c] %x %y]
+    bind $c <ButtonRelease-1> \
+	 [list [namespace current]::move_b1r [double% $c] [double% $chatid]]
+    bind $c <Button-3> \
+	 [list [namespace current]::popup_menu [double% $c] [double% $chatid] %X %Y]
+    bind $c <Motion> {}
+    $c configure -cursor ""
+}
+
 proc wb::move_b1p {c chatid x y} {
     variable move
 
@@ -1234,12 +1258,10 @@
 
     send_svg $chatid $tag
     wm withdraw $wt
-    reset_bind $c $chatid
 }
 
 proc wb::text_cancel {wt c chatid} {
     wm withdraw $wt
-    reset_bind $c $chatid
 }
 
 ###############################################################################



More information about the Tkabber-dev mailing list