Eskil

Check-in [4da657b981]
Login

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

Overview
Comment:Use a dynamic grid to handle file list in commit dialog.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4da657b98125f784ceb15830ae56d3356ff4d603309fc498aa70bb8039afe621
User & Date: peter 2019-02-05 23:53:53.455
Context
2019-02-06
00:00
Bumped revision to 2.8.4 check-in: cb69d0b582 user: peter tags: trunk
2019-02-05
23:53
Use a dynamic grid to handle file list in commit dialog. check-in: 4da657b981 user: peter tags: trunk
2019-02-04
23:51
Added file select to changes check-in: 2300d33a45 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
    }
}

#####################################
# GUI stuff
#####################################

# A little helper to make a scrolled window
# It returns the name of the scrolled window
proc Scroll {dir class w args} {
    switch -- $dir {
        both {
            set scrollx 1
            set scrolly 1
        }







|







2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
    }
}

#####################################
# GUI stuff
#####################################

# A little helper to make a window with scrollbars
# It returns the name of the scrolled window
proc Scroll {dir class w args} {
    switch -- $dir {
        both {
            set scrollx 1
            set scrolly 1
        }
2460
2461
2462
2463
2464
2465
2466






























































2467
2468
2469
2470
2471
2472
2473
        grid $w.sby -row 0 -column 1 -sticky ns
    }
    grid columnconfigure $w 0 -weight 1
    grid rowconfigure    $w 0 -weight 1

    return $w.s
}































































################
# Align function
################

proc enableAlign {top} {
    eval $::widgets($top,enableAlignCmd)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
        grid $w.sby -row 0 -column 1 -sticky ns
    }
    grid columnconfigure $w 0 -weight 1
    grid rowconfigure    $w 0 -weight 1

    return $w.s
}

# Rearrange a dynamic grid to a specified number of columns
proc DynGridRearrange {w cols} {
    # Go down columns first. Thus we must know how many rows there will be.
    set children [grid slaves $w._dyn]
    set rows [expr {([llength $children] + $cols - 1) / $cols}]
    set row 0
    set col 0
    foreach child $children {
        grid $child -row $row -column $col
        grid columnconfigure $w._dyn $col -uniform a
        incr row
        if {$row >= $rows} {
            incr col
            set row 0
        }
    }
    # Clear other columns from uniform in case we shrunk
    if {$row != 0} {
        incr col
    }
    for {} {$col < 15} {incr col} {
        grid columnconfigure $w._dyn $col -uniform ""
    }
    # Recalculate
    update idletasks
    # Propagate Height
    set height [winfo reqheight $w._dyn]
    $w configure -width 100 -height $height
}

# Update dynamic grid on configure event
proc DynGridRedo {w} {
    set maxW 0
    set children [grid slaves $w._dyn]
    foreach child $children {
        set maxW [expr {max($maxW,[winfo reqwidth $child])}]
    }
    set fW [winfo width $w]
    set cols [expr {max(1,$fW / $maxW)}]
    # Rerrange if needed
    lassign [grid size $w._dyn] mCols mRows
    if {$mCols != $cols} {
        DynGridRearrange $w $cols
    }
}

# Ask for widget to have its children managed by dynGrid.
proc dynGridManage {w} {
    # Limit its inital requirements
    pack propagate $w 0
    $w configure -width 100 -height 10
    set children [winfo children $w]
    # Add an inner frame
    ttk::frame $w._dyn
    lower $w._dyn
    pack $w._dyn -fill both -expand 1
    # Get all children managed
    grid {*}$children -in $w._dyn -padx 3 -pady 3 -sticky w
    # React
    bind $w <Configure> "DynGridRedo $w"
}

################
# Align function
################

proc enableAlign {top} {
    eval $::widgets($top,enableAlignCmd)
Changes to src/rev.tcl.
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860

    grid $w.t  - -sticky news -padx 3 -pady 3
    grid $w.ok $w.ca -padx 3 -pady 3
    grid columnconfigure $w $w.t -weight 1 -uniform a
    grid rowconfigure    $w $w.t -weight 1

    if {[llength $postcmd] > 1} {
        # TODO: Scrolled frame
        ttk::frame $w.f -padding 1
        grid $w.f - -sticky news -padx 3 -pady 3

        set t 0
        set maxW 0
        foreach fileName $postcmd {
            set ::eskil($top,commit,fileselect$t) 1
            ttk::checkbutton $w.f.cb$t -text $fileName \
                    -variable ::eskil($top,commit,fileselect$t)
            set rw [winfo reqwidth $w.f.cb$t]
            set maxW [expr {max($maxW, $rw)}]
            incr t
        }
        # Figure out how many columns
        set rw [winfo reqwidth $w.t]
        set cols [expr {max($rw / $maxW, 2)}]
        set rows [expr {($t + $cols - 1) / $cols}]

        set t 0
        set row 0
        set col 0
        foreach fileName $postcmd {
            grid $w.f.cb$t -row $row -column $col -sticky "w" -padx 1 -pady 1
            incr t
            incr row
            if {$row >= $rows} {
                incr col
                set row 0
            }
        }
    }

    tkwait visibility $w
    focus -force $w.t
    tkwait window $w.dummy

    if {!$::eskil($top,logdialogok)} {







|




<




<
<


<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<







1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827

1828
1829
1830
1831


1832
1833




1834












1835
1836
1837
1838
1839
1840
1841

    grid $w.t  - -sticky news -padx 3 -pady 3
    grid $w.ok $w.ca -padx 3 -pady 3
    grid columnconfigure $w $w.t -weight 1 -uniform a
    grid rowconfigure    $w $w.t -weight 1

    if {[llength $postcmd] > 1} {
        # TODO: Scrolled frame maybe? Is dynamic grid enough?
        ttk::frame $w.f -padding 1
        grid $w.f - -sticky news -padx 3 -pady 3

        set t 0

        foreach fileName $postcmd {
            set ::eskil($top,commit,fileselect$t) 1
            ttk::checkbutton $w.f.cb$t -text $fileName \
                    -variable ::eskil($top,commit,fileselect$t)


            incr t
        }




        dynGridManage $w.f












    }

    tkwait visibility $w
    focus -force $w.t
    tkwait window $w.dummy

    if {!$::eskil($top,logdialogok)} {