︙ | | |
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
-
+
-
+
|
catch {file delete $f}
}
set ::tmpfiles {}
}
}
# Insert lineno and text
proc insertLine {top n line text {tag {}} {linetag {}}} {
proc insertLine {top n line text {tag {equal}} {linetag {}}} {
$::widgets($top,wDiff$n) insert end "$text\n" $tag
if {$linetag ne ""} {
append tag " $linetag"
}
if {$tag != ""} {
if {$tag != "equal"} {
set tag "hl$::HighLightCount $tag"
}
$::widgets($top,wLine$n) insert end [myFormL $line] $tag
}
# Insert an empty line on one side of the diff.
proc emptyLine {top n {highlight 1}} {
|
︙ | | |
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
|
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
|
+
+
|
-foreground black -padx 2 -pady 0 -height 1 -wrap word
$top.balloon.t$x tag configure new1 -foreground $Pref(colornew1) \
-background $Pref(bgnew1)
$top.balloon.t$x tag configure change -foreground $Pref(colorchange) \
-background $Pref(bgchange)
$top.balloon.t$x tag configure new2 -foreground $Pref(colornew2) \
-background $Pref(bgnew2)
$top.balloon.t$x tag configure equal -foreground $Pref(colorequal) \
-background $Pref(bgequal)
pack $top.balloon.t$x -side "top" -padx 1 -pady 1 -fill both -expand 1
set tags {}
foreach {key value index} $data($x) {
if {$key eq "tagon"} {
lappend tags $value
set tags [lsort -unique $tags]
|
︙ | | |
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
|
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
|
+
+
|
foreach top $::diff(diffWindows) {
if {$top eq ".clipdiff"} continue
if {$top != ".dirdiff"} {
foreach item {wLine1 wDiff1 wLine2 wDiff2} {
set w $::widgets($top,$item)
$w tag configure equal -foreground $Pref(colorequal) \
-background $Pref(bgequal)
$w tag configure new1 -foreground $Pref(colornew1) \
-background $Pref(bgnew1)
$w tag configure change -foreground $Pref(colorchange) \
-background $Pref(bgchange)
$w tag configure new2 -foreground $Pref(colornew2) \
-background $Pref(bgnew2)
}
|
︙ | | |
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
|
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
|
$top.m.md add command -label "Nuisance" -command [list makeNuisance \
$top "It looks like you are trying out the debug menu."]
}
initDiffData $top
return $top
}
proc ValidateNewColors {} {
global TmpPref
foreach item {colorchange bgchange colornew1 bgnew1
colornew2 bgnew2 colorequal bgequal} {
if {![info exists TmpPref($item)]} continue
set col $TmpPref($item)
if {$col eq ""} continue
if {[catch {winfo rgb . $col}]} {
# FIXA: Error message
# Just restore for now
set TmpPref($item) $::Pref($item)
}
}
}
# Set new preferences.
proc applyPref {} {
global Pref TmpPref
ValidateNewColors
array set Pref [array get TmpPref]
applyColor
}
# Update test color fields.
proc testColor {} {
global TmpPref
ValidateNewColors
.pr.fc.t1 tag configure change -foreground $TmpPref(colorchange) \
-background $TmpPref(bgchange)
.pr.fc.t2 tag configure new1 -foreground $TmpPref(colornew1) \
-background $TmpPref(bgnew1)
.pr.fc.t3 tag configure new2 -foreground $TmpPref(colornew2) \
-background $TmpPref(bgnew2)
.pr.fc.t4 tag configure equal -foreground $TmpPref(colorequal) \
-background $TmpPref(bgequal)
}
# Color dialog.
proc selColor {name} {
global TmpPref
set old $TmpPref($name)
if {$old eq ""} {
set t [tk_chooseColor -parent .pr -initialcolor $TmpPref($name)]
set t [tk_chooseColor -parent .pr]
} else {
set t [tk_chooseColor -parent .pr -initialcolor $old]
}
if {$t != ""} {
set TmpPref($name) $t
}
}
# Create a window for changing preferences.
# Currently only colors are changed in this dialog.
|
︙ | | |
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
|
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
|
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
|
ttk::label .pr.fc.l1 -text "Colours" -anchor w
ttk::label .pr.fc.l2 -text "Text" -anchor w
ttk::label .pr.fc.l3 -text "Background" -anchor w
ttk::entryX .pr.fc.e1 -textvariable "TmpPref(colorchange)" -width 10
ttk::entryX .pr.fc.e2 -textvariable "TmpPref(colornew1)" -width 10
ttk::entryX .pr.fc.e3 -textvariable "TmpPref(colornew2)" -width 10
ttk::entryX .pr.fc.e4 -textvariable "TmpPref(colorequal)" -width 10
ttk::button .pr.fc.b1 -text "Sel" -command "selColor colorchange"
ttk::button .pr.fc.b2 -text "Sel" -command "selColor colornew1"
ttk::button .pr.fc.b3 -text "Sel" -command "selColor colornew2"
ttk::button .pr.fc.b4 -text "Sel" -command "selColor colorequal"
ttk::entryX .pr.fc.e4 -textvariable "TmpPref(bgchange)" -width 10
ttk::entryX .pr.fc.e5 -textvariable "TmpPref(bgnew1)" -width 10
ttk::entryX .pr.fc.e6 -textvariable "TmpPref(bgnew2)" -width 10
ttk::entryX .pr.fc.e5 -textvariable "TmpPref(bgchange)" -width 10
ttk::entryX .pr.fc.e6 -textvariable "TmpPref(bgnew1)" -width 10
ttk::entryX .pr.fc.e7 -textvariable "TmpPref(bgnew2)" -width 10
ttk::entryX .pr.fc.e8 -textvariable "TmpPref(bgequal)" -width 10
ttk::button .pr.fc.b4 -text "Sel" -command "selColor bgchange"
ttk::button .pr.fc.b5 -text "Sel" -command "selColor bgnew1"
ttk::button .pr.fc.b6 -text "Sel" -command "selColor bgnew2"
ttk::button .pr.fc.b5 -text "Sel" -command "selColor bgchange"
ttk::button .pr.fc.b6 -text "Sel" -command "selColor bgnew1"
ttk::button .pr.fc.b7 -text "Sel" -command "selColor bgnew2"
ttk::button .pr.fc.b8 -text "Sel" -command "selColor bgequal"
text .pr.fc.t1 -width 12 -height 1 -font myfont -takefocus 0
text .pr.fc.t2 -width 12 -height 1 -font myfont -takefocus 0
text .pr.fc.t3 -width 12 -height 1 -font myfont -takefocus 0
text .pr.fc.t4 -width 12 -height 1 -font myfont -takefocus 0
.pr.fc.t1 tag configure change -foreground $TmpPref(colorchange) \
-background $TmpPref(bgchange)
.pr.fc.t2 tag configure new1 -foreground $TmpPref(colornew1) \
-background $TmpPref(bgnew1)
.pr.fc.t3 tag configure new2 -foreground $TmpPref(colornew2) \
-background $TmpPref(bgnew2)
.pr.fc.t4 tag configure equal -foreground $TmpPref(colorequal) \
-background $TmpPref(bgequal)
.pr.fc.t1 insert end "Changed text" change
.pr.fc.t2 insert end "Deleted text" new1
.pr.fc.t3 insert end "Added text" new2
.pr.fc.t4 insert end "Equal text" equal
.pr.fc.t1 configure -state disabled
.pr.fc.t2 configure -state disabled
.pr.fc.t3 configure -state disabled
.pr.fc.t4 configure -state disabled
ttk::button .pr.b1 -text "Apply" -command applyPref
ttk::button .pr.b2 -text "Test" -command testColor
ttk::button .pr.b3 -text "Close" -command {destroy .pr}
grid .pr.fc.l1 .pr.fc.l2 x .pr.fc.l3 x -row 0 -sticky ew -padx 1 -pady 1
grid .pr.fc.t1 .pr.fc.e1 .pr.fc.b1 .pr.fc.e4 .pr.fc.b4 -row 1 \
grid .pr.fc.t1 .pr.fc.e1 .pr.fc.b1 .pr.fc.e5 .pr.fc.b5 -row 1 \
-sticky nsew -padx 1 -pady 1
grid .pr.fc.t2 .pr.fc.e2 .pr.fc.b2 .pr.fc.e5 .pr.fc.b5 -row 2 \
grid .pr.fc.t2 .pr.fc.e2 .pr.fc.b2 .pr.fc.e6 .pr.fc.b6 -row 2 \
-sticky nsew -padx 1 -pady 1
grid .pr.fc.t3 .pr.fc.e3 .pr.fc.b3 .pr.fc.e6 .pr.fc.b6 -row 3 \
grid .pr.fc.t3 .pr.fc.e3 .pr.fc.b3 .pr.fc.e7 .pr.fc.b7 -row 3 \
-sticky nsew -padx 1 -pady 1
grid .pr.fc.t4 .pr.fc.e4 .pr.fc.b4 .pr.fc.e8 .pr.fc.b8 -row 4 \
-sticky nsew -padx 1 -pady 1
grid columnconfigure .pr.fc {1 3} -weight 1
pack .pr.fc -side top -fill x
pack .pr.b1 .pr.b2 .pr.b3 -side left -expand 1 -fill x -anchor s \
-padx 2 -pady 2
}
|
︙ | | |
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
|
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
|
+
+
|
# Maybe change to TkFixedFont in 8.5 ?
set Pref(fontfamily) Courier
set Pref(ignore) "-b"
set Pref(nocase) 0
set Pref(nodigit) 0
set Pref(parse) 2
set Pref(lineparsewords) 0
set Pref(colorequal) ""
set Pref(colorchange) red
set Pref(colornew1) darkgreen
set Pref(colornew2) blue
set Pref(bgequal) ""
set Pref(bgchange) \#ffe0e0
set Pref(bgnew1) \#a0ffa0
set Pref(bgnew2) \#e0e0ff
set Pref(context) 0
set Pref(marklast) 1
set Pref(linewidth) 80
set Pref(lines) 60
|
︙ | | |