︙ | | |
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
-
+
-
-
-
-
+
+
+
+
-
-
|
variable leftDir ""
variable rightDir ""
constructor {args} {
variable color
install tree using tablelist::tablelist $win.tree -height 20 \
-movablecolumns no -setgrid no -showseparators yes \
-columns {0 "Structure" 0 Name 0 Size 0 Date 0 Name 0 Size 0 Date}
-columns {0 "Structure" 0 Size 0 Date 0 Size 0 Date}
install vsb using scrollbar $win.vsb -orient vertical \
-command "$tree yview"
install hsb using scrollbar $win.hsb -orient horizontal \
-command "$tree xview"
set AfterId ""
set IdleQueue {}
$tree configure -yscrollcommand "$vsb set" -xscrollcommand "$hsb set"
$tree columnconfigure 0 -name structure
$tree columnconfigure 1 -name leftname -hide 0
$tree columnconfigure 2 -name leftsize -align right
$tree columnconfigure 3 -name leftdate
$tree columnconfigure 4 -name rightname -hide 0
$tree columnconfigure 1 -name leftsize -align right
$tree columnconfigure 2 -name leftdate
$tree columnconfigure 3 -name rightsize -align right
$tree columnconfigure 4 -name rightdate
$tree columnconfigure 5 -name rightsize -align right
$tree columnconfigure 6 -name rightdate
set color(unknown) grey
set color(empty) grey
set color(equal) {}
set color(new) green
set color(old) blue
set color(change) red
|
︙ | | |
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
-
-
|
$tree cellconfigure $topIndex,structure -text $d1
} else {
$tree cellconfigure $topIndex,structure -text "$d1 vs $d2"
}
$tree rowattrib $topIndex type directory
$self SetNodeStatus $topIndex empty
$tree rowattrib $topIndex leftfull $leftDir
$tree cellconfigure $topIndex,leftname -text [file tail $leftDir]
$tree rowattrib $topIndex rightfull $rightDir
$tree cellconfigure $topIndex,rightname -text [file tail $rightDir]
$self UpdateDirNode $topIndex
}
# Format a time stamp for display
proc FormatDate {date} {
clock format $date -format "%Y-%m-%d %H:%M:%S"
|
︙ | | |
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
|
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
-
|
}
new - old - change {
set pstatus change
break
}
}
}
#puts "Setting parent [$tree set $parent leftname] to $pstatus"
$self SetNodeStatus $parent $pstatus
}
method UpdateDirNode {node} {
if {[$tree rowattrib $node type] ne "directory"} {
return
}
|
︙ | | |
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
|
682
683
684
685
686
687
688
689
690
691
692
693
694
695
|
-
-
-
-
-
-
-
-
|
set rightfull [$tree rowattrib $node rightfull]
set equal [CompareFiles $leftfull $rightfull]
if {$equal} {
$self SetNodeStatus $node equal
} else {
$self SetNodeStatus $node change
}
#$self CompareDirs $leftfull $rightfull $node
#$self SetNodeStatus $node unknown
#$tree set $node leftfull
#$tree set $node leftname
#$tree set $node rightfull
#$tree set $node rightname
}
# List files under a directory node
# Returns status for the new node
method ListFiles {df1 df2 node} {
if {$df1 ne ""} {
set type [file type $df1]
|
︙ | | |
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
|
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
|
set size2 ""
set time2 ""
} else {
set size2 $stat2(size)
set time2 [FormatDate $stat2(mtime)]
}
if {$type eq "directory"} {
# If a directory is present in only one side, make sure it shows
# up in that side's listing
set showleft ""
set showright ""
if {$df1 eq ""} {
set showright $name/
} elseif {$df2 eq ""} {
set showleft $name/
}
set values [list $name \
$showleft "" "" \
$showright "" ""]
"" "" \
"" ""]
} else {
set name1 [file tail $df1]
set name2 [file tail $df2]
set values [list $name \
$name1 $size1 $time1 \
$name2 $size2 $time2]
$size1 $time1 \
$size2 $time2]
}
set id [$tree insertchild $node end $values]
$tree rowattrib $id type $type
$tree rowattrib $id status unknown
$tree rowattrib $id leftfull $df1
$tree rowattrib $id rightfull $df2
|
︙ | | |