]> git.entuzijast.net Git - imunes.git/commitdiff
Merge changes from RELENG_4_11.
authormarko <marko>
Thu, 19 Jul 2007 08:27:45 +0000 (08:27 +0000)
committermarko <marko>
Thu, 19 Jul 2007 08:27:45 +0000 (08:27 +0000)
Bug found by:
Submitted by:
Reviewed by:
Approved by:
Obtained from:

imunes.tcl
initgui.tcl
install.sh

index b06041a05ad23be3b0172c03a914e68320390be3..a51370bebcc7ae0b9e1bcb0780a8d2b601e05628 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: imunes.tcl,v 1.23 2007/07/19 03:14:13 marko Exp $ 
+# $Id: imunes.tcl,v 1.24 2007/07/19 08:27:45 marko Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -104,6 +104,8 @@ source "$ROOTDIR/$LIBDIR/lanswitch.tcl"
 source "$ROOTDIR/$LIBDIR/rj45.tcl"
 
 source "$ROOTDIR/$LIBDIR/editor.tcl"
+source "$ROOTDIR/$LIBDIR/annotations.tcl"
+
 source "$ROOTDIR/$LIBDIR/help.tcl"
 source "$ROOTDIR/$LIBDIR/filemgmt.tcl"
 
@@ -157,6 +159,9 @@ source "$ROOTDIR/$LIBDIR/ns2imunes.tcl"
 set node_list {}
 set link_list {}
 set canvas_list {}
+set oval_list {}
+set rectangle_list {}
+set text_list {}
 set prefs {}
 set eid e0
 
index f1ecd35c69986626564cfcabc2a54b58a651016b..337150e23848d20ac6e15479a67703832a189e5f 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: initgui.tcl,v 1.37 2007/07/19 02:33:14 marko Exp $ 
+# $Id: initgui.tcl,v 1.38 2007/07/19 08:27:45 marko Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -38,7 +38,7 @@
 # NAME
 #    initgui.tcl
 # FUNCTION
-#    Initialize GUI. Not included in imunes when opearting in batch mode.
+#    Initialize GUI. Not included when operating in batch mode.
 #****
 
 
@@ -56,7 +56,7 @@
 #      link currently created, this value is set to an empty string.
 #    * selectbox -- the value of the box representing all the selected items
 #    * selected -- containes the list of node_id's of all selected nodes.
-#    * newCanves -- 
+#    * newCanvas -- 
 #
 #    * animatephase -- starting dashoffset. With this value the effect of 
 #      rotating line around selected itme is achived. 
 #****
 
 
-    
 set newlink ""
 set selectbox ""
 set selected ""
@@ -117,10 +116,14 @@ set cursorState 0
 set clock_seconds 0
 set oper_mode edit
 set grid 24
+set showGrid 1
 set zoom 1.0
 set curcanvas [lindex $canvas_list 0]
 set autorearrange_enabled 0
 
+# resize Oval/Rectangle, "false" or direction: north/west/east/...
+set resizemode false
+
 #
 # Initialize a few variables to default values
 #
@@ -130,6 +133,17 @@ set defEthBandwidth 100000000
 set defSerBandwidth 2048000
 set defSerDelay 2500
 
+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
+set defTextColor #000000
+
 set showIfNames 0
 set showIfIPaddrs 0
 set showIfIPv6addrs 0
@@ -137,6 +151,9 @@ set showNodeLabels 1
 set showLinkLabels 0
 set showIPsecConfig 1
 
+set showBkgImage 0
+set showAnnotations 1
+
 set supp_router_models "xorp quagga static"
 set def_router_model quagga
 
@@ -146,7 +163,7 @@ set def_router_model quagga
 #
 
 wm minsize . 640 400
-wm geometry . 1016x716
+wm geometry . 1016x716-30+30
 wm title . IMUNES
 
 menu .menubar
@@ -204,6 +221,7 @@ bind . <Control-s> "fileSaveDialogBox"
     $w.e1 insert 0 "lpr"
     pack $w.e1 -side top -pady 5 -padx 10 -fill x
 }
+
 .menubar.file add separator
 .menubar.file add command -label Quit -underline 0 -command { exit }
 
@@ -245,7 +263,7 @@ menu .menubar.canvas -tearoff 0
     set changed 1
     updateUndoLog
 }
-.menubar.canvas add command -label "Rename" -command renameCanvasPopup
+.menubar.canvas add command -label "Rename" -command { renameCanvasPopup 0 0 }
 .menubar.canvas add command -label "Delete" -command {
     if { [llength $canvas_list] == 1 } {
         return
@@ -266,6 +284,11 @@ menu .menubar.canvas -tearoff 0
 }
 .menubar.canvas add separator
 .menubar.canvas add command -label "Resize" -command resizeCanvasPopup
+
+# There are unresolved scale issues for Background images
+# .menubar.canvas add command -label "Background Image" -underline 0 \
+#     -command { selectBkgImage }
+
 .menubar.canvas add separator
 .menubar.canvas add command -label "Previous" -accelerator "PgUp" \
     -command { switchCanvas prev }
@@ -357,6 +380,16 @@ menu .menubar.view -tearoff 0
        }
     }
 }
+# .menubar.view add checkbutton -label "Show Background Image" \
+#     -underline 5 -variable showBkgImage \
+#     -command { redrawAll }
+.menubar.view add checkbutton -label "Show Annotations" \
+    -underline 5 -variable showAnnotations \
+    -command { redrawAll }
+.menubar.view add checkbutton -label "Show Grid" \
+    -underline 5 -variable showGrid \
+    -command { redrawAll }
+
 .menubar.view add command -label "Show All" \
     -underline 5 -command {
        set showIfNames 1
@@ -443,13 +476,47 @@ foreach b {select link hub lanswitch router host pc rj45} {
            }
        }
     pack .left.$b -side top
+    # hover status line
+    switch -exact -- $b {
+       select { set msg "Select tool" }
+       link { set msg "Create link" }
+       hub { set msg "Add new Hub" }
+       lanswitch { set msg "Add new LAN switch" }
+       router { set msg "Add new Router" }
+       host { set msg "Add new Host" }
+       pc { set msg "Add new PC" }
+       rj45 { set msg "Add new external interface" }
+       default { set msg "" }
+    }
+    bind .left.$b <Any-Enter> ".bottom.textbox config -text {$msg}"
+    bind .left.$b <Any-Leave> ".bottom.textbox config -text {}"
 }
+
+foreach b {rectangle oval text} {
+    set image [image create photo -file $ROOTDIR/$LIBDIR/icons/tiny/$b.gif]
+    radiobutton .left.$b -indicatoron 0 \
+       -variable activetool -value $b -selectcolor [.left cget -bg] \
+       -width 32 -height 32 -activebackground gray -image $image \
+       -command {
+           global activetool
+       }
+    pack .left.$b -side bottom
+    # hover status line
+    switch -exact -- $b {
+       rectangle { set msg "Rectangle" }
+       oval { set msg "Oval" }
+       text { set msg "Text" }
+       default { set msg "" }
+    }
+    bind .left.$b <Any-Enter> ".bottom.textbox config -text {$msg}"
+    bind .left.$b <Any-Leave> ".bottom.textbox config -text {}"
+}
+
+
 foreach b {router host pc hub lanswitch frswitch rj45} {
     set $b [image create photo -file $ROOTDIR/$LIBDIR/icons/normal/$b.gif]
 }
 set pseudo [image create photo]
-set text [image create photo]
-
 
 . configure -background #808080
 frame .grid
@@ -459,6 +526,7 @@ set c [canvas .c -bd 0 -relief sunken -highlightthickness 0\
        -background gray \
        -xscrollcommand ".hframe.scroll set" \
        -yscrollcommand ".vframe.scroll set"]
+
 canvas .hframe.t -width 300 -height 18 -bd 0 -highlightthickness 0 \
        -background gray \
        -xscrollcommand ".hframe.ts set"
@@ -476,7 +544,7 @@ bind .hframe.t <Double-1> {
            set curcanvas $canvas
            switchCanvas none
        } else {
-           renameCanvasPopup
+           renameCanvasPopup %X %Y
        }
     }
 }
@@ -503,6 +571,8 @@ frame .bottom
 pack .bottom -side bottom -fill x
 label .bottom.textbox -relief sunken -bd 1 -anchor w -width 999
 label .bottom.zoom -relief sunken -bd 1 -anchor w -width 10
+bind .bottom.zoom <Double-1> "setZoom %X %Y"
+bind .bottom.zoom <3> "selectZoom %X %Y"
 label .bottom.cpu_load -relief sunken -bd 1 -anchor w -width 9
 label .bottom.mbuf -relief sunken -bd 1 -anchor w -width 15
 label .bottom.oper_mode -relief sunken -bd 1 -anchor w -width 9
@@ -523,12 +593,26 @@ $c bind link <Any-Leave> "anyLeave $c"
 $c bind linklabel <Any-Leave> "anyLeave $c"
 $c bind node <Double-1> "popupConfigDialog $c"
 $c bind nodelabel <Double-1> "popupConfigDialog $c"
+$c bind grid <Double-1> "double1onGrid $c %x %y"
 $c bind link <Double-1> "popupConfigDialog $c"
 $c bind linklabel <Double-1> "popupConfigDialog $c"
+$c bind oval <Double-1> "popupConfigDialog $c"
+$c bind rectangle <Double-1> "popupConfigDialog $c"
+$c bind text <Double-1> "popupConfigDialog $c"
+$c bind text <KeyPress> "textInsert $c %A"
+$c bind text <Return> "textInsert $c \\n"
 $c bind node <3> "button3node $c %x %y"
 $c bind nodelabel <3> "button3node $c %x %y"
 $c bind link <3> "button3link $c %x %y"
 $c bind linklabel <3> "button3link $c %x %y"
+
+$c bind oval <3> "button3annotation oval $c %x %y"
+$c bind rectangle <3> "button3annotation rectangle $c %x %y"
+$c bind text <3> "button3annotation text $c %x %y"
+
+$c bind selectmark <Any-Enter> "selectmarkEnter $c %x %y"
+$c bind selectmark <Any-Leave> "selectmarkLeave $c %x %y"
+
 bind $c <1> "button1 $c %x %y none"
 bind $c <Control-Button-1> "button1 $c %x %y ctrl"
 bind $c <B1-Motion> "button1-motion $c %x %y"
@@ -546,6 +630,9 @@ bind . <Left> ".c xview scroll -1 units"
 bind . <Down> ".c yview scroll 1 units"
 bind . <Up> ".c yview scroll -1 units"
 
+# Escape to Select mode
+bind . <Key-Escape> "set activetool select"
+
 #
 # Popup-menu hierarchy
 #
index 93adb43e0374d970839c410fb62130a6e41b17ce..1d99441efdf6be7979608164da380d1d7fb413a5 100755 (executable)
@@ -26,12 +26,13 @@ lib_files="nodecfg.tcl linkcfg.tcl cfgparse.tcl ipv4.tcl ipv6.tcl exec.tcl \
           canvas.tcl editor.tcl filemgmt.tcl help.tcl initgui.tcl \
           quagga.tcl xorp.tcl static.tcl pc.tcl host.tcl \
           lanswitch.tcl rj45.tcl hub.tcl ns2imunes.tcl ipsec.tcl \
-          topogen.tcl"
+          topogen.tcl annotations.tcl"
 
-tiny_icons="delete.gif hub.gif frswitch.gif host.gif \
-           lanswitch.gif link.gif pc.gif rj45.gif router.gif select.gif"
+tiny_icons="oval.gif delete.gif frswitch.gif host.gif hub.gif \
+           lanswitch.gif link.gif pc.gif rectangle.gif rj45.gif \
+            router.gif select.gif text.gif"
 
-normal_icons="hub.gif frswitch.gif host.gif lanswitch.gif pc.gif \
+normal_icons="frswitch.gif host.gif hub.gif lanswitch.gif pc.gif \
              rj45.gif router.gif"