Eskil

Diff
Login

Differences From Artifact [20f67c0ad7]:

To Artifact [f00b02f37b]:


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
290
291



292
293

294
295
296
297
298
299
300
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
290
291
292
293
294


295
296
297
298

299
300
301
302
303
304
305
306







-
+




+
+






+
+
+









-
-
+
+
+

-
+







    constructor {args} {
        variable color
        install tree using tablelist::tablelist $win.tree -height 20 \
                -movablecolumns no -setgrid no -showseparators yes \
                -expandcommand [mymethod expandCmd] \
                -collapsecommand [mymethod collapseCmd] \
                -fullseparators yes \
                -columns {0 "Structure" 0 Size 0 Date 0 Size 0 Date}
                -columns {0 "Structure" 0 Size 0 Date 0 Copy 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"
        #puts "Theme [tablelist::getCurrentTheme]"
        #puts "Style [ttk::style configure .]"

        # Use demo images from Tablelist
        set dir $::eskil(thisDir)/../lib/tablelist/demos
        set img(clsd) [image create photo -file [file join $dir clsdFolder.gif]]
        set img(open) [image create photo -file [file join $dir openFolder.gif]]
        set img(file) [image create photo -file [file join $dir file.gif]]
        # FIXA: arrow images
        set img(left) [image create photo mapleft -width 10 -height 8]
        set img(right) [image create photo mapright -width 10 -height 8]

        set AfterId ""
        set IdleQueue {}

        $tree configure -yscrollcommand "$vsb set" -xscrollcommand "$hsb set"

        $tree columnconfigure 0 -name structure
        $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 3 -name command
        $tree columnconfigure 4 -name rightsize -align right
        $tree columnconfigure 5 -name rightdate

        destroy [$tree separatorpath 1] [$tree separatorpath 3]
        destroy [$tree separatorpath 1] [$tree separatorpath 4]

        set color(unknown) grey
        set color(empty) grey
        set color(equal) {}
        set color(new) green
        set color(old) blue
        set color(change) red
742
743
744
745
746
747
748

749
750
751
752

753
754
755
756
757
758
759

760



761
762
763
764
765
766
767
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768

769
770
771
772
773
774
775
776
777
778







+




+







+
-
+
+
+







        } else {
            set size2 $stat2(size)
            set time2 [FormatDate $stat2(mtime)]
        }
        if {$type eq "directory"} {
            set values [list $name \
                    "" "" \
                    "" \
                    "" ""]
        } else {
            set values [list $name \
                    $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
        if {$type ne "directory"} {
        $tree cellconfigure $id,structure -image $img(file)
            $tree cellconfigure $id,structure -image $img(file)
            $tree cellconfigure $id,command -window [mymethod addCmdCol]
        }

        if {$type eq "directory"} {
            ## Make it so that this node is openable
            $tree collapse $id
            #$tree insertchild $id end dummy ;# a dummy
            $tree cellconfigure $id,structure -text $name/
            $self SetNodeStatus $id empty
776
777
778
779
780
781
782
























783
784
785
786
787
788
789
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







            $self SetNodeStatus $id old
        } else {
            $self SetNodeStatus $id unknown
            $self AddNodeToIdle $id
        }
        return [$tree rowattrib $id status]
    }

    method addCmdCol {tbl row col w} {
        set status [$tree rowattrib $row status]
        set type   [$tree rowattrib $row type]
        ttk::frame $w
        if 1 {
            ttk::button $w.bl -image $img(left) -style Toolbutton \
                    -command [mymethod CopyFile $row right]
            ttk::button $w.br -image $img(right) -style Toolbutton \
                    -command [mymethod CopyFile $row left]
        } elseif 1 {
            ttk::button $w.bl -text "<" -style Toolbutton \
                    -command [mymethod CopyFile $row right]
            ttk::button $w.br -text ">" -style Toolbutton \
                    -command [mymethod CopyFile $row left]
        } else {
            ttk::label $w.bl -text "<"
            bind $w.bl <Button-1> [mymethod CopyFile $row right]
            ttk::label $w.br -text ">"
            bind $w.br <Button-1> [mymethod CopyFile $row left]
        }
        pack $w.bl $w.br -side left -fill y
        pack $w.bl -padx {0 1}
    }

    # Compare two directories.
    method CompareDirs {dir1 dir2 node} {
        global Pref
        if {$dir1 eq ""} {
            set files1 {}
        } else {