56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
+
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
+
-
+
+
+
|
# Four files, with optional revision
set fields {base1 change1 base2 change2}
ttk::label $win.l1 -text "Base 1"
ttk::label $win.l2 -text "Changed 1"
ttk::label $win.l3 -text "Base 2"
ttk::label $win.l4 -text "Changed 2"
set txt1 {
set txt1 "First diff is made from Base 1 to Changed 1.\n If a file is\
empty and have a revision, the other file name is used."
addBalloon $win.l1 $txt1
addBalloon $win.l2 $txt1
First diff is made from Base 1 to Changed 1.\n
If a file is empty and have a revision, the other file name is used.
}
addBalloon $win.l1 -fmt $txt1
addBalloon $win.l2 -fmt txt1
set txt2 [string map {1 2 First Second} $txt1]
addBalloon $win.l3 $txt2
addBalloon $win.l4 $txt2
addBalloon $win.l3 -fmt $txt2
addBalloon $win.l4 -fmt $txt2
ttk::label $win.el -text "File path"
ttk::label $win.rl -text "Rev"
addBalloon $win.rl -fmt {
addBalloon $win.rl "If you want to use a revisioned controlled file\
instead\n of the one on disk, add a revision here.\
E.g. 0 can be used\n for latest commited revision."
If you want to use a revisioned controlled file
instead of the one on disk, add a revision here.
E.g. 0 can be used for latest commited revision.
}
set n 0
foreach field $fields {
incr n
ttk::entryX $win.e$n -width 60 -textvariable [myvar files($field)]
ttk::button $win.b$n -text "Browse" \
-command [mymethod browseFile $field]
ttk::entryX $win.r$n -width 6 -textvariable [myvar revs($field)]
ttk::entryX $win.r$n -width 8 -textvariable [myvar revs($field)]
}
ttk::button $win.bd -text "Diff" -command [mymethod doFourWayDiff] \
-underline 0 -width 8
bind $win <Alt-d> [list $win.bd invoke]
grid x $win.el x $win.rl -sticky w -padx 3 -pady 3
grid $win.l1 $win.e1 $win.b1 $win.r1 -sticky we -padx 3 -pady 3
grid $win.l2 $win.e2 $win.b2 $win.r2 -sticky we -padx 3 -pady 3
grid $win.l3 $win.e3 $win.b3 $win.r3 -sticky we -padx 3 -pady {10 3}
grid $win.l4 $win.e4 $win.b4 $win.r4 -sticky we -padx 3 -pady 3
grid $win.bd - - -padx 3 -pady {10 3}
grid columnconfigure $win $win.el -weight 1
# Set up file dropping in entry windows if TkDnd is available
if {![catch {package require tkdnd}]} {
dnd bindtarget $win text/uri-list <Drop> "[mymethod fileDrop any ] %D"
dnd bindtarget $win.e1 text/uri-list <Drop> "[mymethod fileDrop base1 ] %D"
dnd bindtarget $win.e2 text/uri-list <Drop> "[mymethod fileDrop change1] %D"
dnd bindtarget $win.e3 text/uri-list <Drop> "[mymethod fileDrop base2 ] %D"
dnd bindtarget $win.e4 text/uri-list <Drop> "[mymethod fileDrop change2] %D"
|