]> git.entuzijast.net Git - imunes.git/commitdiff
Circle and rectangle annotations are now configured using single procedure.
authormiljenko <miljenko>
Fri, 20 Jul 2007 15:15:37 +0000 (15:15 +0000)
committermiljenko <miljenko>
Fri, 20 Jul 2007 15:15:37 +0000 (15:15 +0000)
Bug found by:
Submitted by:
Reviewed by:
Approved by:
Obtained from:

annotations.tcl
editor.tcl
initgui.tcl

index dbe3a97d5fa8af0cc91a04ace187d5383a397ab3..c12bb58e2fdefd59a78efb9ddce7fd64c839cfd8 100644 (file)
 #****
 
 proc annotationConfig { c target } {
-    global newoval $target
-
-    set color [lindex [lsearch -inline [set $target] "color *"] 1]
-    set label [lindex [lsearch -inline [set $target] "label *"] 1]
-    set lcolor [lindex [lsearch -inline [set $target] "labelcolor *"] 1]
-    
-    # set newoval $target
     switch -exact -- [nodeType $target] {
        oval {
-           popupOvalDialog $c $target "true" $color $label $lcolor
+           popupAnnotationDialog $c $target "true"
        }
        rectangle {
-           popupRectDialog $c $target "true" $color $label $lcolor
+           # popupRectDialog $c $target "true"
+           popupAnnotationDialog $c $target "true"
        }
        text {
            textConfig $c $target 
@@ -67,76 +61,10 @@ proc annotationConfig { c target } {
 #   * lcolor -- label (text) color
 #****
 
-proc popupOvalDialog { c target modify color label lcolor } {
-    global newoval defOvalColor $target
-
-
-    # do nothing, return, if coords are empty
-    if { $target == 0 && [$c coords "$newoval"] == "" } {
-       return
-    }
-    set wi .popup
-    catch {destroy $wi}
-    toplevel $wi
-
-    wm transient $wi .
-    wm resizable $wi 0 0
-
-    if { $modify == "true" } {
-       set windowtitle "Configure oval"
-    } else {
-       set windowtitle "Add a new oval"
-    }
-    wm title $wi $windowtitle
-    frame $wi.lab -borderwidth 4
-    label $wi.lab.name_label -text "Text for top of oval:"
-    entry $wi.lab.name -bg white -width 16 \
-       -validate focus -invcmd "focusAndFlash %W"
-    $wi.lab.name insert 0 $label
-    pack $wi.lab.name $wi.lab.name_label -side right -padx 4 -pady 4
-    pack $wi.lab -side top
-
-    # color selection controls
-    frame $wi.colors -borderwidth 4
-    label $wi.colors.label -text "Color:"
-    if { $color == "" } {
-       set color $defOvalColor
-    }
-    if { $lcolor == "" } {
-       set lcolor black
-    }
-    label $wi.colors.color -text $color -width 8 \
-       -bg $color -fg $lcolor
-    button $wi.colors.fg -text "fg" -command \
-       "popupColor fg $wi.colors.color false"
-    button $wi.colors.bg -text "bg" -command \
-       "popupColor bg $wi.colors.color true"
-    pack $wi.colors.fg $wi.colors.bg $wi.colors.color $wi.colors.label \
-       -side right -padx 4 -pady 4
-    pack $wi.colors -side top
-
-    set applycmd "popupOvalApply $c $wi $target"
-
-    # Add new oval or modify old one?
-    if { $modify == "true"  } {
-       set cancelcmd "destroy $wi"
-       set applytext "Modify oval"
-    } else {
-       set cancelcmd "destroy $wi; destroyNewoval $c"
-       set applytext "Add oval"
-    }
 
-    frame $wi.butt -borderwidth 6
-    button $wi.butt.apply -text $applytext -command "$applycmd"
-    button $wi.butt.cancel -text "Cancel" -command $cancelcmd
-    bind $wi <Key-Escape> "$cancelcmd" 
-    bind $wi <Key-Return> "$applycmd"
-    pack $wi.butt.cancel $wi.butt.apply -side right
-    pack $wi.butt -side bottom
-    after 100 {
-       grab .popup
-    }
-    return
+proc adjustBkg { c wi } {
+    set color [$wi.colors.color cget -text]
+    $wi.border.color configure -bg $color
 }
 
 
@@ -158,44 +86,6 @@ proc destroyNewoval { c } {
 }
 
 
-# create a oval
-proc popupOvalApply { c wi target} {
-    global newoval annotation_list
-    global $target
-    global changed
-
-    # oval attributes
-    set caption [string trim [$wi.lab.name get]]
-    set color [$wi.colors.color cget -text]
-    set labelcolor [$wi.colors.color cget -fg]
-    set coords [$c coords "$target"]
-    set iconcoords "iconcoords"
-
-    # build the oval object
-    if {$target == 0} {
-       set object [newObjectId annotation]
-       lappend annotation_list $object
-       set coords [$c coords "$newoval"]
-    } else {
-       set object $target
-    }
-    global $object
-    set $object {}
-    lappend $iconcoords $coords
-    lappend $object $iconcoords "color $color" \
-       "label {$caption}" "labelcolor $labelcolor"
-
-    # draw it
-    drawOval $object
-
-    destroyNewoval $c
-    destroy $wi 
-    set changed 1
-    updateUndoLog
-    redrawAll
-}
-
-
 # oval/rectangle/text right-click menu
 
 proc button3annotation { type c x y } {
@@ -247,7 +137,8 @@ proc deleteAnnotation { c type target } {
 
 
 proc drawOval {oval} {
-    global $oval defOvalColor defOvalLabelFont zoom curcanvas
+    global $oval defFillColor zoom curcanvas
+    global defTextFontFamily defTextFontSize
 
     set coords [getNodeCoords $oval]
     set x1 [expr {[lindex $coords 0] * $zoom}]
@@ -257,21 +148,36 @@ proc drawOval {oval} {
     set color [lindex [lsearch -inline [set $oval] "color *"] 1]
     set label [lindex [lsearch -inline [set $oval] "label *"] 1]
     set lcolor [lindex [lsearch -inline [set $oval] "labelcolor *"] 1]
+    set bordercolor [lindex [lsearch -inline [set $oval] "border *"] 1]
+    set width [lindex [lsearch -inline [set $oval] "width *"] 1]
     set lx [expr $x1 + (($x2 - $x1) / 2)]
     set ly [expr ($y1 + 20)]
 
-    if { $color == "" } {
-       set color $defOvalColor
-    }
-    if { $lcolor == "" } {
-       set lcolor black
-    }
+    if { $color == "" } { set color $defFillColor }
+    if { $lcolor == "" } { set lcolor black }
+    if { $width == "" } { set width 1 }
+    if { $bordercolor == "" } { set bordercolor black }
+
     # -outline red -stipple gray50
     set newoval [.c create oval $x1 $y1 $x2 $y2 \
-       -fill $color -width 2 -tags "oval $oval"]
+       -fill $color -width $width -outline $bordercolor -tags "oval $oval"]
     .c raise $newoval background
+
+    set fontfamily [lindex [lsearch -inline [set $oval] "fontfamily *"] 1]
+    set fontsize [lindex [lsearch -inline [set $oval] "fontsize *"] 1]
+    if { $fontfamily == "" } {
+       set fontfamily $defTextFontFamily
+    }
+    if { $fontsize == "" } {
+       set fontsize $defTextFontSize
+    }
+    set newfontsize $fontsize
+    set font [list "$fontfamily" $fontsize]
+    set effects [lindex [lsearch -inline [set $oval] "effects *"] 1]
+
     .c create text $lx $ly -tags "oval $oval" -text $label \
-       -justify center -font $defOvalLabelFont -fill $lcolor
+       -justify center -font "$font $effects" -fill $lcolor
+
     setNodeCanvas $oval $curcanvas
     setType $oval "oval"
 }
@@ -313,7 +219,7 @@ proc popupColor { type l settext } {
 #   * x0, y0 -- Coordinates of the upper left corner, in pixels
 #   * x3, y3 -- Coordinates of the lower right corner, in pixels
 #   * radius -- Radius of the bend at the corners, in any form
-#             acceptable to Tk_GetPixels
+#              acceptable to Tk_GetPixels
 #   * args   -- Other args suitable to a 'polygon' item on the canvas
 # Example:
 #   roundRect .c 100 50 500 250 $rad -fill white -outline black -tags rectangle
@@ -348,7 +254,8 @@ proc roundRect { w x0 y0 x3 y3 radius args } {
  }
 
 proc drawRect {rectangle} {
-    global $rectangle defRectColor defRectLabelFont zoom curcanvas
+    global $rectangle defFillColor zoom curcanvas
+    global defTextFontFamily defTextFontSize
 
     set coords [getNodeCoords $rectangle]
     if {$coords == ""} {
@@ -363,35 +270,116 @@ proc drawRect {rectangle} {
     set color [lindex [lsearch -inline [set $rectangle] "color *"] 1]
     set label [lindex [lsearch -inline [set $rectangle] "label *"] 1]
     set lcolor [lindex [lsearch -inline [set $rectangle] "labelcolor *"] 1]
+    set bordercolor [lindex [lsearch -inline [set $rectangle] "border *"] 1]
+    set width [lindex [lsearch -inline [set $rectangle] "width *"] 1]
+    set rad [lindex [lsearch -inline [set $rectangle] "rad *"] 1]
     set lx [expr $x1 + (($x2 - $x1) / 2)]
     set ly [expr ($y1 + 20)]
 
-    if { $color == "" } {
-       set color $defRectColor
-    }
-    if { $lcolor == "" } {
-       set lcolor black
-    }
+    if { $color == "" } { set color $defFillColor }
+    if { $lcolor == "" } { set lcolor black }
+    if { $bordercolor == "" } { set bordercolor black }
+    if { $width == "" } { set width 1 }
     # rounded-rectangle radius
-    set rad 25
+    if { $rad == "" } { set rad 25 }
+
     set newrect [roundRect .c $x1 $y1 $x2 $y2 $rad \
-       -fill $color -outline blue -tags "rectangle $rectangle"]
+       -fill $color -outline $bordercolor -width $width \
+       -tags "rectangle $rectangle"]
     .c raise $newrect background
+
+    set fontfamily [lindex [lsearch -inline [set $rectangle] "fontfamily *"] 1]
+    set fontsize [lindex [lsearch -inline [set $rectangle] "fontsize *"] 1]
+    if { $fontfamily == "" } {
+       set fontfamily $defTextFontFamily
+    }
+    if { $fontsize == "" } {
+       set fontsize $defTextFontSize
+    }
+    set newfontsize $fontsize
+    set font [list "$fontfamily" $fontsize]
+    set effects [lindex [lsearch -inline [set $rectangle] "effects *"] 1]
+
     .c create text $lx $ly -tags "rectangle $rectangle" -text $label \
-       -justify center -font $defRectLabelFont -fill $lcolor
+       -justify center -font "$font $effects" -fill $lcolor
+
     setNodeCanvas $rectangle $curcanvas
     setType $rectangle "rectangle"
 }
 
 
-proc popupRectDialog { c rectangle modify color label lcolor } {
-    global newrect defRectColor
-    global $rectangle
+proc popupAnnotationDialog { c target modify } {
+    global newrect newoval defFillColor
+    global $target
+    global width rad
+    global fontfamily fontsize defTextFontFamily defTextFontSize
 
     # do nothing, return, if coords are empty
-    if { $rectangle == 0 && [$c coords "$newrect"] == "" } {
+    if { $target == 0 \
+           && [$c coords "$newrect"] == "" \
+           && [$c coords "$newoval"] == "" } {
        return
     }
+
+    if { $target == 0 } {
+       set width 1
+       set rad 25
+       set coords [$c bbox "$newrect"]
+       if { [$c coords "$newrect"] == "" } {
+           set coords [$c bbox "$newoval"]
+           set annotationType "oval"
+       } else {
+           set annotationType "rectangle"
+       }
+       set fontfamily ""
+       set fontsize ""
+       set effects ""
+       set color ""
+       set label ""
+       set lcolor ""
+       set bordercolor ""
+    } else {
+       set width [lindex [lsearch -inline [set $target] "width *"] 1]
+       set rad [lindex [lsearch -inline [set $target] "rad *"] 1]
+       set coords [$c bbox "$target"]
+       set color [lindex [lsearch -inline [set $target] "color *"] 1]
+       set fontfamily [lindex [lsearch -inline [set $target] "fontfamily *"] 1]
+       set fontsize [lindex [lsearch -inline [set $target] "fontsize *"] 1]
+       set effects [lindex [lsearch -inline [set $target] "effects *"] 1]
+
+       set label [lindex [lsearch -inline [set $target] "label *"] 1]
+       set lcolor [lindex [lsearch -inline [set $target] "labelcolor *"] 1]
+       set bordercolor [lindex [lsearch -inline [set $target] "border *"] 1]
+       set annotationType [lindex [lsearch -inline [set $target] "type *"] 1]
+    }
+
+    if { $color == "" } { set color $defFillColor }
+    if { $lcolor == "" } { set lcolor black }
+    if { $bordercolor == "" } { set bordercolor black }
+    if { $width == "" } { set width 1 }
+    if { $rad == "" } { set rad 25 }
+    if { $fontfamily == "" } { set fontfamily $defTextFontFamily }
+    if { $fontsize == "" } { set fontsize $defTextFontSize }
+
+    set textBold 0
+    set textItalic 0
+    set textUnderline 0
+    if { [lsearch $effects bold ] != -1} {set textBold 1}
+    if { [lsearch $effects italic ] != -1} {set textItalic 1}
+    if { [lsearch $effects underline ] != -1} {set textUnderline 1}
+
+    set x1 [lindex $coords 0] 
+    set y1 [lindex $coords 1]
+    set x2 [lindex $coords 2]
+    set y2 [lindex $coords 3]
+    set xx [expr {abs($x2 - $x1)}] 
+    set yy [expr {abs($y2 - $y1)}] 
+    if { $xx > $yy } {
+       set maxrad [expr $yy * 3.0 / 8.0]
+    } else {
+       set maxrad [expr $xx * 3.0 / 8.0]
+    }
+
     set wi .popup
     catch {destroy $wi}
     toplevel $wi
@@ -400,63 +388,146 @@ proc popupRectDialog { c rectangle modify color label lcolor } {
     wm resizable $wi 0 0
 
     if { $modify == "true" } {
-       set windowtitle "Configure rectangle $rectangle"
+       set windowtitle "Configure $annotationType $target"
     } else {
-       set windowtitle "Add a new rectangle"
+       set windowtitle "Add a new $annotationType"
     }
     wm title $wi $windowtitle
-    frame $wi.lab -borderwidth 4
-    label $wi.lab.name_label -text "Text for top of rectangle:"
-    entry $wi.lab.name -bg white -width 16 \
+
+    frame $wi.text -relief groove -bd 2
+    frame $wi.text.lab
+    label $wi.text.lab.name_label -text "Text for top of $annotationType:"
+    entry $wi.text.lab.name -bg white -fg $lcolor -width 32 \
        -validate focus -invcmd "focusAndFlash %W"
-    $wi.lab.name insert 0 $label
-    pack $wi.lab.name $wi.lab.name_label -side right -padx 4 -pady 4
-    pack $wi.lab -side top
+    $wi.text.lab.name insert 0 $label
+    pack $wi.text.lab.name_label $wi.text.lab.name -side left -anchor w \
+       -padx 2 -pady 2 -fill x
+    pack $wi.text.lab -side top -fill x
 
-    # color selection controls
-    frame $wi.colors -borderwidth 4
-    label $wi.colors.label -text "Color:"
+    frame $wi.text.format 
+
+    set fontmenu [tk_optionMenu $wi.text.format.fontmenu fontfamily "$fontfamily"]
+    set sizemenu [tk_optionMenu $wi.text.format.fontsize fontsize "$fontsize"]
+
+
+    # color selection 
     if { $color == "" } {
-       set color $defRectColor
-    }
-    if { $lcolor == "" } {
-       set lcolor black
+       set color $defTextColor
     }
+    button $wi.text.format.fg -text "Text color" -command \
+       "popupColor fg $wi.text.lab.name false"
+    checkbutton $wi.text.format.bold -text "Bold" -variable textBold \
+       -command [list fontupdate $wi.text.lab.name bold]
+    checkbutton $wi.text.format.italic -text "Italic" -variable textItalic \
+       -command [list fontupdate $wi.text.lab.name italic]
+    checkbutton $wi.text.format.underline -text "Underline" \
+       -variable textUnderline \
+       -command [list fontupdate $wi.text.lab.name underline]
+
+    if {$textBold == 1} {      $wi.text.format.bold select
+    } else {                   $wi.text.format.bold deselect }
+    if {$textItalic == 1} {    $wi.text.format.italic select
+    } else {                   $wi.text.format.italic deselect }
+    if {$textUnderline == 1} { $wi.text.format.underline select
+    } else {                   $wi.text.format.underline deselect }
+
+    pack $wi.text.format.fontmenu \
+       $wi.text.format.fontsize \
+       $wi.text.format.fg \
+       $wi.text.format.bold \
+       $wi.text.format.italic \
+       $wi.text.format.underline \
+       -side left -pady 2
+
+    pack $wi.text.format -side top -fill x
+
+    pack $wi.text -side top -fill x
+
+    fontupdate $wi.text.lab.name fontfamily $fontfamily
+    fontupdate $wi.text.lab.name fontsize $fontsize
+
+    # fill color, border color
+    frame $wi.colors -relief groove -bd 2
+    # color selection controls
+    label $wi.colors.label -text "Fill color:"
+
     label $wi.colors.color -text $color -width 8 \
        -bg $color -fg $lcolor
-    button $wi.colors.fg -text "fg" -command \
-       "popupColor fg $wi.colors.color false"
-    button $wi.colors.bg -text "bg" -command \
+    button $wi.colors.bg -text "Color" -command \
        "popupColor bg $wi.colors.color true"
-    pack $wi.colors.fg $wi.colors.bg $wi.colors.color $wi.colors.label \
-       -side right -padx 4 -pady 4
-    pack $wi.colors -side top
+    pack $wi.colors.label $wi.colors.color $wi.colors.bg \
+       -side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.colors -side top -fill x
+
+
+    $fontmenu delete 0
+    foreach f [lsort -dictionary [font families]] {
+       $fontmenu add radiobutton -value "$f" -label $f \
+           -variable fontfamily \
+           -command [list fontupdate $wi.text.lab.name fontfamily $f]
+    }
+    $sizemenu delete 0
+    foreach f {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72} {
+       $sizemenu add radiobutton -value "$f" -label $f \
+           -variable fontsize \
+           -command [list fontupdate $wi.text.lab.name fontsize $f]
+    }
+    # border selection controls
+    frame $wi.border -relief groove -bd 2
+    label $wi.border.label -text "Border color:"
+    label $wi.border.color -text $bordercolor -width 8 \
+       -bg $color -fg $bordercolor
+    label $wi.border.width_label -text "Border width:"
+    set widthMenu [tk_optionMenu $wi.border.width width "$width"]
+    $widthMenu delete 0
+    foreach f {0 1 2 3 4 5 6 7 8 9 10} {
+       $widthMenu add radiobutton -value $f -label $f \
+           -variable width
+    }
+    button $wi.border.fg -text "Color" -command \
+       "popupColor fg $wi.border.color true"
+    pack $wi.border.label $wi.border.color $wi.border.fg \
+       $wi.border.width_label $wi.border.width \
+       $wi.border.fg $wi.border.color $wi.border.label \
+       -side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.border -side top -fill x
+
+if { $annotationType == "rectangle" } {
+    frame $wi.radius -relief groove -bd 2
+    scale $wi.radius.rad -from 0 -to [expr int($maxrad)] \
+       -length 400 -variable rad \
+       -orient horizontal -label "Radius of the bend at the corners: " \
+       -tickinterval [expr int($maxrad / 15) + 1] -showvalue true
+    pack $wi.radius.rad -side left -padx 2 -pady 2 -anchor w -fill x
+    pack $wi.radius -side top -fill x
+}
 
     # Add new oval or modify old one?
     if { $modify == "true"  } {
        set cancelcmd "destroy $wi"
-       set applytext "Modify rectangle"
+       set applytext "Modify $annotationType"
     } else {
        set cancelcmd "destroy $wi; destroyNewRect $c"
-       set applytext "Add rectangle"
+       set applytext "Add $annotationType"
     }
     
     frame $wi.butt -borderwidth 6
-    button $wi.butt.apply -text $applytext \
-       -command "popupRectApply $c $wi $rectangle"
+    button $wi.butt.apply -text $applytext -command "popupAnnotationApply $c $wi $target"
 
     button $wi.butt.cancel -text "Cancel" -command $cancelcmd
     bind $wi <Key-Escape> "$cancelcmd" 
-    bind $wi <Key-Return> "popupRectApply $c $wi $rectangle"
+    bind $wi <Key-Return> "popupAnnotationApply $c $wi $target"
     pack $wi.butt.cancel $wi.butt.apply -side right
     pack $wi.butt -side bottom
+
     after 100 {
        grab .popup
     }
     return
 }
 
-
 # helper for popupOvalDialog and popupOvalApply
 proc destroyNewRect { c } {
     global newrect
@@ -464,38 +535,59 @@ proc destroyNewRect { c } {
     set newrect ""
 }
 
-# create a rectangle
-proc popupRectApply { c wi target } {
-    global newrect annotation_list
+
+proc popupAnnotationApply { c wi target } {
+    global newrect newoval annotation_list
     global $target
     global changed
+    global width rad
+    global fontfamily fontsize textBold textItalic textUnderline
 
     # attributes
-    set caption [string trim [$wi.lab.name get]]
+    set caption [string trim [$wi.text.lab.name get]]
     set color [$wi.colors.color cget -text]
-    set labelcolor [$wi.colors.color cget -fg]
+    set labelcolor [$wi.text.lab.name cget -fg]
+    set bordercolor [$wi.border.color cget -text]
     set coords [$c coords "$target"]
     set iconcoords "iconcoords"
 
-    # build the oval object
-    set object $target
     if { $target == 0 } {
-       # Create a new rectangle object
+       # Create a new annotation object
        set target [newObjectId annotation]
        global $target
        lappend annotation_list $target
        set coords [$c coords $newrect]
+       if { "$coords" == "" } {
+           set coords [$c coords $newoval]
+           set annotationType "oval"
+       } else {
+           set annotationType "rectangle"
+       }
     } else {
        set coords [getNodeCoords $target]
+       set annotationType [lindex [lsearch -inline [set $target] "type *"] 1]
     }
     set $target {}
     lappend $iconcoords $coords
     lappend $target $iconcoords "color $color" \
-       "label {$caption}" "labelcolor $labelcolor"
-    
+       "label {$caption}" "labelcolor $labelcolor" \
+       "fontfamily {$fontfamily}" "fontsize $fontsize" \
+       "width $width" "border $bordercolor" "rad $rad"
+
+    set ef {}
+    if {"$textBold" == 1}   { lappend ef bold} 
+    if {"$textItalic" == 1} { lappend ef italic} 
+    if {"$textUnderline" == 1}   { lappend ef underline} 
+    if {"$ef" != ""} { lappend $target "effects {$ef}"}
+
     # draw it
-    drawRect $target
-    destroyNewRect $c
+    if { $annotationType == "rectangle" } {
+        drawRect $target
+        destroyNewRect $c
+    } elseif { $annotationType == "oval" } {
+        drawOval $target
+        destroyNewoval $c
+    }
 
     set changed 1
     updateUndoLog
@@ -697,12 +789,8 @@ proc textConfig { c target } {
     if { [lsearch $effects italic ] != -1} {set textItalic 1}
     if { [lsearch $effects underline ] != -1} {set textUnderline 1}
 
-    if { $fontfamily == "" } {
-       set fontfamily $defTextFontFamily
-    }
-    if { $fontsize == "" } {
-       set fontsize $defTextFontSize
-    }
+    if { $fontfamily == "" } { set fontfamily $defTextFontFamily }
+    if { $fontsize == "" } { set fontsize $defTextFontSize }
 
     set wi .popup
     catch {destroy $wi}
@@ -712,8 +800,6 @@ proc textConfig { c target } {
     wm resizable $wi 1 1
     wm title $wi "Configure text"
 
-    $wi configure -bd 2 -relief raised
-
     entry $wi.text -background white
     frame $wi.prop 
     frame $wi.action
@@ -746,21 +832,12 @@ proc textConfig { c target } {
        -variable textUnderline \
        -command [list fontupdate $wi.text underline]
 
-    if {$textBold == 1} {
-       $wi.prop.format.bold select
-    } else {
-       $wi.prop.format.bold deselect
-    }
-    if {$textItalic == 1} {
-       $wi.prop.format.italic select
-    } else {
-       $wi.prop.format.italic deselect
-    }
-    if {$textUnderline == 1} {
-       $wi.prop.format.underline select
-    } else {
-       $wi.prop.format.underline deselect
-    }
+    if {$textBold == 1} {      $wi.prop.format.bold select
+    } else {                   $wi.prop.format.bold deselect }
+    if {$textItalic == 1} {    $wi.prop.format.italic select
+    } else {                   $wi.prop.format.italic deselect }
+    if {$textUnderline == 1} { $wi.prop.format.underline select
+    } else {                   $wi.prop.format.underline deselect }
 
     pack $wi.prop.format.label \
         $wi.prop.format.fg \
@@ -853,18 +930,10 @@ proc textConfigApply { c wi target } {
     lappend $target $iconcoords "color $color" "label {$caption}"\
        "fontfamily {$fontfamily}" "fontsize $fontsize"
     set ef {}
-    if {"$textBold" == 1} {
-       lappend ef bold
-    } 
-    if {"$textItalic" == 1} {
-       lappend ef italic
-    } 
-    if {"$textUnderline" == 1} {
-       lappend ef underline
-    } 
-    if {"$ef" != ""} {
-       lappend $target "effects {$ef}"
-    }
+    if {"$textBold" == 1} { lappend ef bold } 
+    if {"$textItalic" == 1} { lappend ef italic } 
+    if {"$textUnderline" == 1} { lappend ef underline } 
+    if {"$ef" != ""} { lappend $target "effects {$ef}" }
 
     # draw it
     drawText $target
@@ -896,3 +965,4 @@ proc drawAnnotation { obj } {
        }
     }
 }
+
index 9c7a0325776b1dfe28bfa6c1414d69b1cbaef8de..5aeffc0d3dd3b08adbecd4ebdde8d1767391e9d8 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: editor.tcl,v 1.62.2.8 2007/07/20 12:57:15 miljenko Exp $ 
+# $Id: editor.tcl,v 1.62.2.9 2007/07/20 15:15:37 miljenko Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -1692,10 +1692,8 @@ proc button1-release { c x y } {
                }
            }
        }
-    } elseif {$activetool == "rectangle" } {
-       popupRectDialog $c 0 "false" "" "" ""
-    } elseif {$activetool == "oval" } {
-       popupOvalDialog $c 0 "false" "" "" ""
+    } elseif {$activetool == "rectangle" || $activetool == "oval" } {
+       popupAnnotationDialog $c 0 "false"
     } elseif {$activetool == "text" } {
        textEnter $c $x $y
     }
@@ -3487,9 +3485,6 @@ proc selectZoom { x y } {
     wm title $w "Select zoom %"
     wm iconname $w "Select zoom %"
 
-    update
-    grab $w
-
     frame $w.buttons
     pack $w.buttons -side bottom -fill x -pady 2m
     button $w.buttons.print -text "Apply" -command "setZoomApply $w"
@@ -3502,5 +3497,9 @@ proc selectZoom { x y } {
     entry $w.e1 -bg white
     $w.e1 insert 0 [expr {int($zoom * 100)}]
     pack $w.e1 -side top -pady 5 -padx 10 -fill x
+
+    update
+    focus $w.e1
+    grab $w
 }
 
index f7eff12f196c7fff499c5316dbef55e7f75b0963..27392fe737bbcb709d5269de39034ceec1b3bf2f 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: initgui.tcl,v 1.34.2.4 2007/07/19 01:30:46 marko Exp $ 
+# $Id: initgui.tcl,v 1.34.2.5 2007/07/20 15:15:37 miljenko Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -133,12 +133,9 @@ set defEthBandwidth 100000000
 set defSerBandwidth 2048000
 set defSerDelay 2500
 
+set defFillColor #C0C0FF
 set newoval ""
-set defOvalColor #CFCFFF
-set defOvalLabelFont "Arial 12"
 set newrect ""
-set defRectColor #C0C0FF
-set defRectLabelFont "Arial 12"
 set defTextFont "Arial 12"
 set defTextFontFamily "Arial"
 set defTextFontSize 12
@@ -397,10 +394,14 @@ menu .menubar.view -tearoff 0
        set showIfIPv6addrs 1
        set showNodeLabels 1
        set showLinkLabels 1
-       redrawAllLinks
-       foreach object [.c find withtag linklabel] {
-           .c itemconfigure $object -state normal
-       }
+       set showBkgImage 1
+       set showAnnotations 1
+       set showGrid 1
+       #redrawAllLinks
+       #foreach object [.c find withtag linklabel] {
+       #    .c itemconfigure $object -state normal
+       #}
+       redrawAll
     }
 .menubar.view add command -label "Show None" \
     -underline 6 -command {
@@ -409,10 +410,14 @@ menu .menubar.view -tearoff 0
        set showIfIPv6addrs 0
        set showNodeLabels 0
        set showLinkLabels 0
-       redrawAllLinks
-       foreach object [.c find withtag linklabel] {
-           .c itemconfigure $object -state hidden
-       }
+       set showBkgImage 0
+       set showAnnotations 0
+       set showGrid 0
+       #redrawAllLinks
+       #foreach object [.c find withtag linklabel] {
+       #    .c itemconfigure $object -state hidden
+       #}
+       redrawAll
     }
 
 .menubar.view add separator