aboutsummaryrefslogtreecommitdiff
path: root/editmode_look-plugin.tcl
blob: f7ab005e8cf39286f26d5b482b9fe35a42522ba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# this script makes it so that the cords are hidden when not in edit mode

proc set_cords_by_editmode {mytoplevel eventname} {
    if {$mytoplevel eq ".pdwindow"} {return}
    set tkcanvas [tkcanvas_name $mytoplevel]
 	if { ! [winfo exists $mytoplevel] } {return}
    if {$::editmode($mytoplevel) == 1} {
        $tkcanvas configure -background "#fff"
        $tkcanvas itemconfigure graph -fill black
        $tkcanvas itemconfigure array -fill black
        $tkcanvas itemconfigure array -activefill blue
        $tkcanvas itemconfigure label -fill black
        $tkcanvas itemconfigure obj -fill black
        $tkcanvas itemconfigure msg -activefill black
        $tkcanvas itemconfigure atom -activefill black
        $tkcanvas itemconfigure cord -fill black
        $tkcanvas itemconfigure {inlet || outlet} -outline black
        $tkcanvas raise cord
    } else {
        $tkcanvas configure -background white
        $tkcanvas itemconfigure graph -fill magenta
        $tkcanvas itemconfigure array -fill cyan
        $tkcanvas itemconfigure array -activefill blue
        $tkcanvas itemconfigure label -fill "#777777"
        $tkcanvas itemconfigure obj -fill grey
        $tkcanvas itemconfigure msg -activefill blue
        $tkcanvas itemconfigure atom -activefill blue
        $tkcanvas itemconfigure cord -fill grey
        $tkcanvas itemconfigure {inlet || outlet} -outline white
        $tkcanvas lower {inlet || outlet || cord}
    }
}

bind PatchWindow <<EditMode>> {+set_cords_by_editmode %W editmode}
bind PatchWindow <<Loaded>> {+set_cords_by_editmode %W loaded}