Fossil

Check-in [af9bda81]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tk diff: New "Files" menu implementation to better handle long file lists.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sbsreloaded
Files: files | file ages | folders
SHA1:af9bda81e4877d1e3933888793cbcc8d1a2d0720
User & Date: joel 2013-07-15 03:05:23
Context
2013-07-16
16:02
Web SBS diff: Was incorrectly using the scrollWidths of the div containers rather than that of the pre elements themselves. Closed-Leaf check-in: 325ed34e user: joel tags: sbsreloaded
2013-07-15
03:05
Tk diff: New "Files" menu implementation to better handle long file lists. check-in: af9bda81 user: joel tags: sbsreloaded
2013-07-13
23:10
Tk diff: Fix up scrolling code that previously assumed equal line lengths. check-in: 2e7b57fa user: joel tags: sbsreloaded
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

620
621
622
623
624
625
626

627
628
629
630
631
632
633
...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
...
701
702
703
704
705
706
707





708
709
710
711
712
713
714
...
807
808
809
810
811
812
813
814
815































816
817
818
819
820
821
822
@   FN_FG      #ffffff
@   FN_PAD     5
@   FONTS      {{DejaVu Sans Mono} Consolas Monaco fixed}
@   FONT_SIZE  9
@   PADX       5
@   WIDTH      80
@   HEIGHT     45

@ }
@ 
@ if {![namespace exists ttk]} {
@   interp alias {} ::ttk::scrollbar {} ::scrollbar
@   interp alias {} ::ttk::menubutton {} ::menubutton
@ }
@ 
................................................................................
@       continue
@     }
@     if {[string compare -length 6 [gets $in] "<table"]} {
@       continue
@     }
@     incr nDiffs
@     set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}]
@     .files.menu add command -label $fn -command "viewDiff $idx"
@     
@     foreach c [cols] {
@       while {[gets $in] ne "<pre>"} continue
@       
@       if {$nDiffs > 1} {
@         $c insert end \n -
@       }
................................................................................
@   foreach c [cols] {
@     set type [colType $c]
@     if {$type ne "txt"} {
@       $c config -width $widths($type)
@     }
@     $c config -state disabled
@   }





@   return $nDiffs
@ }
@ 
@ proc viewDiff {idx} {
@   .txtA yview $idx
@   .txtA xview moveto 0
@ }
................................................................................
@   Home  y {moveto 0}
@   End   y {moveto 1}
@ } {
@   bind . <$key> "scroll-$axis $args; break"
@   bind . <Shift-$key> continue
@ }
@ 
@ ::ttk::menubutton .files -menu .files.menu -text "Files"
@ menu .files.menu -tearoff 0































@ 
@ foreach {side syncCol} {A .txtB B .txtA} {
@   set ln .ln$side
@   text $ln
@   $ln tag config - -justify right
@   
@   set txt .txt$side







>







 







|







 







>
>
>
>
>







 







|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
...
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
...
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
...
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
@   FN_FG      #ffffff
@   FN_PAD     5
@   FONTS      {{DejaVu Sans Mono} Consolas Monaco fixed}
@   FONT_SIZE  9
@   PADX       5
@   WIDTH      80
@   HEIGHT     45
@   LB_HEIGHT  25
@ }
@ 
@ if {![namespace exists ttk]} {
@   interp alias {} ::ttk::scrollbar {} ::scrollbar
@   interp alias {} ::ttk::menubutton {} ::menubutton
@ }
@ 
................................................................................
@       continue
@     }
@     if {[string compare -length 6 [gets $in] "<table"]} {
@       continue
@     }
@     incr nDiffs
@     set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}]
@     .wfiles.lb insert end $fn
@     
@     foreach c [cols] {
@       while {[gets $in] ne "<pre>"} continue
@       
@       if {$nDiffs > 1} {
@         $c insert end \n -
@       }
................................................................................
@   foreach c [cols] {
@     set type [colType $c]
@     if {$type ne "txt"} {
@       $c config -width $widths($type)
@     }
@     $c config -state disabled
@   }
@   if {$nDiffs <= [.wfiles.lb cget -height]} {
@     .wfiles.lb config -height $nDiffs
@     grid remove .wfiles.sb
@   }
@   
@   return $nDiffs
@ }
@ 
@ proc viewDiff {idx} {
@   .txtA yview $idx
@   .txtA xview moveto 0
@ }
................................................................................
@   Home  y {moveto 0}
@   End   y {moveto 1}
@ } {
@   bind . <$key> "scroll-$axis $args; break"
@   bind . <Shift-$key> continue
@ }
@ 
@ ::ttk::menubutton .files -text "Files"
@ toplevel .wfiles
@ wm withdraw .wfiles
@ update idletasks
@ wm transient .wfiles .
@ wm overrideredirect .wfiles 1
@ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \
@   -yscroll {.wfiles.sb set}
@ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview}
@ grid .wfiles.lb .wfiles.sb -sticky ns
@ bind .files <1> {
@   set x [winfo rootx %W]
@   set y [expr {[winfo rooty %W]+[winfo height %W]}]
@   wm geometry .wfiles +$x+$y
@   wm deiconify .wfiles
@   focus .wfiles.lb
@ }
@ bind .wfiles <FocusOut> {wm withdraw .wfiles}
@ bind .wfiles <Escape> {focus .}
@ foreach evt {1 Return} {
@   bind .wfiles.lb <$evt> {
@     catch {
@       set idx [lindex [.txtA tag ranges fn] [expr {[%W curselection]*2}]]
@       viewDiff $idx
@     }
@     focus .
@     break
@   }
@ }
@ bind .wfiles.lb <Motion> {
@   %W selection clear 0 end
@   %W selection set @%x,%y
@ }
@ 
@ foreach {side syncCol} {A .txtB B .txtA} {
@   set ln .ln$side
@   text $ln
@   $ln tag config - -justify right
@   
@   set txt .txt$side