Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Changed file sorting to always be dictionary order regardless of platform. Cleaned up preferences. Copied BrowseDir from dirdiff. Added destructor to cancel idle callback. Handle status update for identical libraries. Added dirdiff toplevel. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0a3dda7c38b7748335e77943d57e2436 |
User & Date: | peter 2007-12-26 16:50:00.000 |
Context
2007-12-26
| ||
16:52 | Complete rework or directory diff window. check-in: b4728d8ec9 user: peter tags: trunk | |
16:50 | Changed file sorting to always be dictionary order regardless of platform. Cleaned up preferences. Copied BrowseDir from dirdiff. Added destructor to cancel idle callback. Handle status update for identical libraries. Added dirdiff toplevel. check-in: 0a3dda7c38 user: peter tags: trunk | |
13:40 | Support changing top directories. Double click on files bring up diff. Implemented context menu entries on files. check-in: 186ee56829 user: peter tags: trunk | |
Changes
Changes to dirdifftest.tcl.
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | + + - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | set dirdiff(rightDir) /home/peter/tcl/tclmaster #set dirdiff(leftDir) /home/peter/src/eskil/gugg1 #set dirdiff(rightDir) /home/peter/src/eskil/gugg2 # Compare file names proc FStrCmp {s1 s2} { # Equality is based on platform's standard # Order is dictionary order |
︙ | |||
60 61 62 63 64 65 66 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - | } set files2 {} foreach file $files { set full [file join $dir $file] # Apply filters if {[FileIsDirectory $full]} { |
︙ | |||
109 110 111 112 113 114 115 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + | } lappend files2 $file } return [Fsort $files2] } |
︙ | |||
235 236 237 238 239 240 241 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | - + | -command "$tree xview" } $tree configure -yscroll "$vsb set" -xscroll "$hsb set" set AfterId "" set IdleQueue {} |
︙ | |||
268 269 270 271 272 273 274 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | + + - + + | grid columnconfigure $win 0 -weight 1 grid rowconfigure $win 0 -weight 1 $self configurelist $args #$self ReStart } destructor { if {$AfterId ne ""} { after cancel $AfterId |
︙ | |||
559 560 561 562 563 564 565 566 567 568 569 570 571 572 | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | + + | #$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] set name [file tail $df1] } else { set type [file type $df2] set name [file tail $df2] |
︙ | |||
609 610 611 612 613 614 615 616 617 618 619 620 621 622 | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | + | $self SetNodeStatus $id new } elseif {$size2 == ""} { $self SetNodeStatus $id old } else { $self SetNodeStatus $id unknown $self AddNodeToIdle $id } return [$tree set $id status] } # Compare two directories. method CompareDirs {dir1 dir2 node} { global Pref if {$dir1 eq ""} { set files1 {} |
︙ | |||
647 648 649 650 651 652 653 | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | - + + - + + | # Equal names, separate them if not the same type set apa [expr {- [FileIsDirectory $df1] \ + [FileIsDirectory $df2]}] } switch -- $apa { 0 { |
︙ | |||
692 693 694 695 696 697 698 | 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 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 779 780 781 782 783 784 785 786 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 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + | } else { set status equal } $self SetNodeStatus $node $status } } snit::widget DirDiff { hulltype toplevel component tree constructor {args} { lappend ::diff(diffWindows) $win wm title $win "Eskil Dir" wm protocol $win WM_DELETE_WINDOW [list cleanupAndExit $win] install tree using DirCompare $win.dc -leftdir $::dirdiff(leftDir) \ -rightdir $::dirdiff(rightDir) frame $win.fe1 frame $win.fe2 menu $win.m $hull configure -menu $win.m $win.m add cascade -menu $win.m.mf -label "File" -underline 0 menu $win.m.mf $win.m.mf add command -label "Compare" -underline 1 \ -command [mymethod DoDirCompare] -accelerator "Alt-c" bind $win <Alt-c> [mymethod DoDirCompare] $win.m.mf add separator $win.m.mf add command -label "Close" -underline 0 \ -command [list cleanupAndExit $win] $win.m.mf add separator $win.m.mf add command -label "Quit" -underline 0 \ -command [list cleanupAndExit all] $win.m add cascade -menu $win.m.mo -label "Preferences" -underline 0 menu $win.m.mo $win.m.mo add command -label "Prefs..." -command makeDirDiffPrefWin $win.m.mo add cascade -label "Check" -menu $win.m.mo.mc menu $win.m.mo.mc $win.m.mo.mc add radiobutton -variable Pref(dir,comparelevel) -value 0 \ -label "Do not check contents" $win.m.mo.mc add radiobutton -variable Pref(dir,comparelevel) -value 1 \ -label "Normal compare" $win.m.mo.mc add radiobutton -variable Pref(dir,comparelevel) -value 2 \ -label "Binary compare" $win.m.mo.mc add checkbutton -variable Pref(dir,ignorekey) \ -label "Ignore \$Keyword:\$" $win.m add cascade -label "Tools" -underline 0 -menu $win.m.mt menu $win.m.mt $win.m.mt add command -label "New Diff Window" -underline 0 \ -command makeDiffWin $win.m.mt add command -label "Clip Diff" -underline 0 \ -command makeClipDiffWin if {$::tcl_platform(platform) eq "windows"} { if {![catch {package require registry}]} { $win.m.mt add separator $win.m.mt add command -label "Setup Registry" -underline 6 \ -command makeRegistryWin } } $win.m add cascade -label "Help" -underline 0 -menu $win.m.help menu $win.m.help $win.m.help add command -label "Tutorial" -command makeTutorialWin \ -underline 0 $win.m.help add command -label "About" -command makeAboutWin -underline 0 if {$::debug} { $win.m add cascade -label "Debug" -menu $win.m.md -underline 0 menu $win.m.md if {$::tcl_platform(platform) eq "windows"} { $win.m.md add checkbutton -label "Console" -variable consolestate \ -onvalue show -offvalue hide -command {console $consolestate} $win.m.md add separator } $win.m.md add command -label "Reread Source" -underline 0 \ -command {EskilRereadSource} $win.m.md add separator $win.m.md add command -label "Redraw Window" -command {makeDirDiffWin 1} } button $win.bu -text "Up Both" -command [mymethod UpDir] \ -underline 0 -padx 15 bind $win <Alt-u> "$win.bu invoke" #catch {font delete myfont} #font create myfont -family $Pref(fontfamily) -size $Pref(fontsize) entry $win.e1 -textvariable dirdiff(leftDir) button $win.bu1 -text "Up" -padx 10 -command [mymethod UpDir 1] button $win.bb1 -text "Browse" -padx 10 \ -command "[list BrowseDir dirdiff(leftDir) $win.e1] [mymethod DoDirCompare]" $win.e1 xview end entry $win.e2 -textvariable dirdiff(rightDir) button $win.bu2 -text "Up" -padx 10 -command [mymethod UpDir 2] button $win.bb2 -text "Browse" -padx 10 \ -command "[list BrowseDir dirdiff(rightDir) $win.e2] [mymethod DoDirCompare]" $win.e2 xview end bind $win.e1 <Return> [mymethod DoDirCompare] bind $win.e2 <Return> [mymethod DoDirCompare] pack $win.bb1 $win.bu1 -in $win.fe1 -side right -pady 1 pack $win.bu1 -padx 6 pack $win.e1 -in $win.fe1 -side left -fill x -expand 1 pack $win.bb2 $win.bu2 -in $win.fe2 -side right -pady 1 pack $win.bu2 -padx 6 pack $win.e2 -in $win.fe2 -side left -fill x -expand 1 grid $win.fe1 $win.bu $win.fe2 -sticky we grid $tree - - -sticky news grid $win.bu -padx 6 grid rowconfigure $win 2 -weight 1 grid columnconfigure $win {0 2} -weight 1 } method DoDirCompare {} { $tree configure -leftdir $::dirdiff(leftDir) \ -rightdir $::dirdiff(rightDir) } # Go up one level in directory hierarchy. # 0 = both method UpDir {{n 0}} { global dirdiff Pref switch $n { 0 { set dirdiff(leftDir) [file dirname $dirdiff(leftDir)] set dirdiff(rightDir) [file dirname $dirdiff(rightDir)] .dirdiff.e1 xview end .dirdiff.e2 xview end } 1 { set dirdiff(leftDir) [file dirname $dirdiff(leftDir)] .dirdiff.e1 xview end } 2 { set dirdiff(rightDir) [file dirname $dirdiff(rightDir)] .dirdiff.e2 xview end } } $self DoDirCompare } } # Transfer preferences from dialog to real settings proc ApplyDirDiffPref {} { foreach item { dir,comparelevel dir,ignorekey dir,onlyrev } { set ::Pref($item) $::TmpPref($item) } # Handle preferences that must be a list foreach item { dir,incfiles dir,exfiles dir,incdirs dir,exdirs } { # Force a split to make sure the list is valid if {[catch {llength $::TmpPref($item)}]} { set ::TmpPref($item) [regexp -all -inline {\S+} $::TmpPref($item)] } set ::Pref($item) $::TmpPref($item) } } # Create directory diff preferences window. proc makeDirDiffPrefWin {} { set top .dirdiffprefs if {[winfo exists $top] && [winfo toplevel $top] eq $top} { raise $top focus -force $top return } else { destroy $top toplevel $top -padx 3 -pady 3 foreach item { dir,comparelevel dir,ignorekey dir,incfiles dir,exfiles dir,incdirs dir,exdirs dir,onlyrev } { set ::TmpPref($item) $::Pref($item) } } wm title $top "Eskil Directory Preferences" set check [labelframe $top.check -text "Check" -padx 3 -pady 3] radiobutton $check.rb1 -variable TmpPref(dir,comparelevel) -value 0 \ -text "Do not check contents" radiobutton $check.rb2 -variable TmpPref(dir,comparelevel) -value 1 \ -text "Normal compare" radiobutton $check.rb3 -variable TmpPref(dir,comparelevel) -value 2 \ -text "Binary compare" grid $check.rb1 -sticky w -padx 3 -pady 3 grid $check.rb2 -sticky w -padx 3 -pady 3 grid $check.rb3 -sticky w -padx 3 -pady 3 grid columnconfigure $check {0 1 2} -uniform a -weight 1 set opts [labelframe $top.opts -text "Options" -padx 3 -pady 3] checkbutton $opts.cb1 -variable TmpPref(dir,ignorekey) \ -text "Ignore \$Keyword:\$" eval pack [winfo children $opts] -side top -anchor w set filter [labelframe $top.filter -text "Filter" -padx 3 -pady 3] label $filter.l1 -text "Include Files" -anchor w entry $filter.e1 -width 20 -textvariable TmpPref(dir,incfiles) label $filter.l2 -text "Exclude Files" -anchor w entry $filter.e2 -width 20 -textvariable TmpPref(dir,exfiles) label $filter.l3 -text "Include Dirs" -anchor w entry $filter.e3 -width 20 -textvariable TmpPref(dir,incdirs) label $filter.l4 -text "Exclude Dirs" -anchor w entry $filter.e4 -width 20 -textvariable TmpPref(dir,exdirs) checkbutton $filter.cb1 -text "Only revision controlled" \ -variable TmpPref(dir,onlyrev) grid $filter.l1 $filter.e1 -sticky we -padx 3 -pady 3 grid $filter.l2 $filter.e2 -sticky we -padx 3 -pady 3 grid $filter.l3 $filter.e3 -sticky we -padx 3 -pady 3 grid $filter.l4 $filter.e4 -sticky we -padx 3 -pady 3 grid $filter.cb1 - -sticky w -padx 3 -pady 3 grid columnconfigure $filter 1 -weight 1 set fb [frame $top.fb -padx 3 -pady 3] button $fb.ok -width 10 -text "Ok" \ -command "ApplyDirDiffPref ; destroy $top" button $fb.ap -width 10 -text "Apply" -command ApplyDirDiffPref button $fb.ca -width 10 -text "Cancel" -command "destroy $top" grid $fb.ok $fb.ap $fb.ca -padx 3 -pady 3 grid columnconfigure $fb {0 1 2} -uniform a -weight 1 pack $fb -side bottom -fill x pack $check $opts $filter -side top -fill x } # Experimental... #preprocess filter på namnen så man kan jämföra bibliotek #med ändrade namn. |