@matheusbsbs / matheus-bagliano / commits / 0fb8f9ce05
Fork 0

git-gui: Flip commit message buffer and diff area.

Since Tk will only supply new space gained from growing the top level to the bottom/right most widget within a panedwindow and most users will be growing a git-gui main window for the purposes of seeing more of the currently shown diff, flipping the order around makes Tk do what the user wants by default. Of course because we also removed the paned window from the commit buffer area it is now impossible to increase the visible space for the commit message. But I don't see this as a huge concern right now as its actually very awkward to try and balance three paned window dividers within the same top level window. We could always add it back if users really want to expand the commit buffer and see more. I also corrected a number of bugs that I accidentally introduced in the last commit. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 7, 2006 at 20:27 UTC 0fb8f9ce05bf65cc9c22f078c4a6dc7dec3ec27a
1 file changed +91 -88
git-gui
+91 -88
@@ -70,7 +70,7 @@ proc repository_state {hdvar ctvar} {
70 proc update_status {{final Ready.}} {
71 global HEAD PARENT commit_type
72 global ui_index ui_other ui_status_value ui_comm
73 - global status_active file_states status_start
73 + global status_active file_states
74
75 if {$status_active || ![lock_index read]} return
76
@@ -84,7 +84,6 @@ proc update_status {{final Ready.}} {
84 set commit_type $new_type
85 }
86
87 - set status_start [clock seconds]
87 array unset file_states
88 foreach w [list $ui_index $ui_other] {
89 $w conf -state normal
@@ -231,7 +230,7 @@ proc read_ls_others {fd final} {
230 }
231
232 proc status_eof {fd buf final} {
234 - global status_active status_start $buf
233 + global status_active $buf
234 global ui_fname_value ui_status_value file_states
235
236 if {[eof $fd]} {
@@ -241,11 +240,7 @@ proc status_eof {fd buf final} {
240 if {[incr status_active -1] == 0} {
241 unlock_index
242
244 - set e1 [clock seconds]
243 display_all_files
246 - set e2 [clock seconds]
247 -puts "TIME [expr $e1 - $status_start] + [expr $e2 - $e1] = [expr $e2 - $status_start]"
248 -
244 set ui_status_value $final
245
246 if {$ui_fname_value != {} && [array names file_states \
@@ -758,10 +753,10 @@ proc display_file {path state} {
753 if {$status_active} return
754
755 set s $file_states($path)
761 - set old_w [mapcol $old_m $path]
762 - set new_w [mapcol $new_m $path]
756 set new_m [lindex $s 0]
764 - set new_ico [mapicon $new_m $path]
757 + set new_w [mapcol $new_m $path]
758 + set old_w [mapcol $old_m $path]
759 + set new_icon [mapicon $new_m $path]
760
761 if {$new_w != $old_w} {
762 set lno [bsearch $old_w $path]
@@ -1498,101 +1493,56 @@ pack $ui_other -side left -fill both -expand 1
1493 $ui_index tag conf in_diff -font [concat $mainfont bold]
1494 $ui_other tag conf in_diff -font [concat $mainfont bold]
1495
1501 -# -- Diff Header
1502 -set ui_fname_value {}
1503 -set ui_fstatus_value {}
1504 -frame .vpane.diff -height 200 -width 400
1505 -frame .vpane.diff.header
1506 -label .vpane.diff.header.l1 -text {File:} -font $mainfont
1507 -label .vpane.diff.header.l2 -textvariable ui_fname_value \
1508 - -anchor w \
1509 - -justify left \
1510 - -font $mainfont
1511 -label .vpane.diff.header.l3 -text {Status:} -font $mainfont
1512 -label .vpane.diff.header.l4 -textvariable ui_fstatus_value \
1513 - -width $max_status_desc \
1514 - -anchor w \
1515 - -justify left \
1516 - -font $mainfont
1517 -pack .vpane.diff.header.l1 -side left
1518 -pack .vpane.diff.header.l2 -side left -fill x
1519 -pack .vpane.diff.header.l4 -side right
1520 -pack .vpane.diff.header.l3 -side right
1521 -
1522 -# -- Diff Body
1523 -frame .vpane.diff.body
1524 -set ui_diff .vpane.diff.body.t
1525 -text $ui_diff -background white -borderwidth 0 \
1526 - -width 80 -height 15 -wrap none \
1527 - -font $difffont \
1528 - -xscrollcommand {.vpane.diff.body.sbx set} \
1529 - -yscrollcommand {.vpane.diff.body.sby set} \
1530 - -cursor $maincursor \
1531 - -state disabled
1532 -scrollbar .vpane.diff.body.sbx -orient horizontal \
1533 - -command [list $ui_diff xview]
1534 -scrollbar .vpane.diff.body.sby -orient vertical \
1535 - -command [list $ui_diff yview]
1536 -pack .vpane.diff.body.sbx -side bottom -fill x
1537 -pack .vpane.diff.body.sby -side right -fill y
1538 -pack $ui_diff -side left -fill both -expand 1
1539 -pack .vpane.diff.header -side top -fill x
1540 -pack .vpane.diff.body -side bottom -fill both -expand 1
1541 -.vpane add .vpane.diff -stick nsew
1542 -
1543 -$ui_diff tag conf dm -foreground red
1544 -$ui_diff tag conf dp -foreground blue
1545 -$ui_diff tag conf da -font [concat $difffont bold]
1546 -$ui_diff tag conf di -foreground "#00a000"
1547 -$ui_diff tag conf dni -foreground "#a000a0"
1548 -$ui_diff tag conf bold -font [concat $difffont bold]
1549 -
1550 -# -- Commit Area
1551 -frame .vpane.commarea -height 170
1552 -.vpane add .vpane.commarea -stick nsew
1496 +# -- Diff and Commit Area
1497 +frame .vpane.lower -height 400 -width 400
1498 +frame .vpane.lower.commarea
1499 +frame .vpane.lower.diff -relief sunken -borderwidth 1
1500 +pack .vpane.lower.commarea -side top -fill x
1501 +pack .vpane.lower.diff -side bottom -fill both -expand 1
1502 +.vpane add .vpane.lower -stick nsew
1503
1504 # -- Commit Area Buttons
1555 -frame .vpane.commarea.buttons
1556 -label .vpane.commarea.buttons.l -text {} \
1505 +frame .vpane.lower.commarea.buttons
1506 +label .vpane.lower.commarea.buttons.l -text {} \
1507 -anchor w \
1508 -justify left \
1509 -font $mainfont
1560 -pack .vpane.commarea.buttons.l -side top -fill x
1561 -pack .vpane.commarea.buttons -side left -fill y
1510 +pack .vpane.lower.commarea.buttons.l -side top -fill x
1511 +pack .vpane.lower.commarea.buttons -side left -fill y
1512
1563 -button .vpane.commarea.buttons.rescan -text {Rescan} \
1513 +button .vpane.lower.commarea.buttons.rescan -text {Rescan} \
1514 -command do_rescan \
1515 -font $mainfont
1566 -pack .vpane.commarea.buttons.rescan -side top -fill x
1567 -lappend disable_on_lock {.vpane.commarea.buttons.rescan conf -state}
1516 +pack .vpane.lower.commarea.buttons.rescan -side top -fill x
1517 +lappend disable_on_lock {.vpane.lower.commarea.buttons.rescan conf -state}
1518
1569 -button .vpane.commarea.buttons.amend -text {Amend Last} \
1519 +button .vpane.lower.commarea.buttons.amend -text {Amend Last} \
1520 -command do_amend_last \
1521 -font $mainfont
1572 -pack .vpane.commarea.buttons.amend -side top -fill x
1573 -lappend disable_on_lock {.vpane.commarea.buttons.amend conf -state}
1522 +pack .vpane.lower.commarea.buttons.amend -side top -fill x
1523 +lappend disable_on_lock {.vpane.lower.commarea.buttons.amend conf -state}
1524
1575 -button .vpane.commarea.buttons.ciall -text {Check-in All} \
1525 +button .vpane.lower.commarea.buttons.ciall -text {Check-in All} \
1526 -command do_checkin_all \
1527 -font $mainfont
1578 -pack .vpane.commarea.buttons.ciall -side top -fill x
1579 -lappend disable_on_lock {.vpane.commarea.buttons.ciall conf -state}
1528 +pack .vpane.lower.commarea.buttons.ciall -side top -fill x
1529 +lappend disable_on_lock {.vpane.lower.commarea.buttons.ciall conf -state}
1530
1581 -button .vpane.commarea.buttons.signoff -text {Sign Off} \
1531 +button .vpane.lower.commarea.buttons.signoff -text {Sign Off} \
1532 -command do_signoff \
1533 -font $mainfont
1584 -pack .vpane.commarea.buttons.signoff -side top -fill x
1534 +pack .vpane.lower.commarea.buttons.signoff -side top -fill x
1535
1586 -button .vpane.commarea.buttons.commit -text {Commit} \
1536 +button .vpane.lower.commarea.buttons.commit -text {Commit} \
1537 -command do_commit \
1538 -font $mainfont
1589 -pack .vpane.commarea.buttons.commit -side top -fill x
1590 -lappend disable_on_lock {.vpane.commarea.buttons.commit conf -state}
1539 +pack .vpane.lower.commarea.buttons.commit -side top -fill x
1540 +lappend disable_on_lock {.vpane.lower.commarea.buttons.commit conf -state}
1541
1542 # -- Commit Message Buffer
1593 -frame .vpane.commarea.buffer
1594 -set ui_comm .vpane.commarea.buffer.t
1595 -set ui_coml .vpane.commarea.buffer.l
1543 +frame .vpane.lower.commarea.buffer
1544 +set ui_comm .vpane.lower.commarea.buffer.t
1545 +set ui_coml .vpane.lower.commarea.buffer.l
1546 label $ui_coml -text {Commit Message:} \
1547 -anchor w \
1548 -justify left \
@@ -1606,15 +1556,68 @@ trace add variable commit_type write {uplevel #0 {
1556 }}
1557 text $ui_comm -background white -borderwidth 1 \
1558 -relief sunken \
1609 - -width 75 -height 10 -wrap none \
1559 + -width 75 -height 9 -wrap none \
1560 -font $difffont \
1611 - -yscrollcommand {.vpane.commarea.buffer.sby set} \
1561 + -yscrollcommand {.vpane.lower.commarea.buffer.sby set} \
1562 -cursor $maincursor
1613 -scrollbar .vpane.commarea.buffer.sby -command [list $ui_comm yview]
1563 +scrollbar .vpane.lower.commarea.buffer.sby -command [list $ui_comm yview]
1564 pack $ui_coml -side top -fill x
1615 -pack .vpane.commarea.buffer.sby -side right -fill y
1565 +pack .vpane.lower.commarea.buffer.sby -side right -fill y
1566 pack $ui_comm -side left -fill y
1617 -pack .vpane.commarea.buffer -side left -fill y
1567 +pack .vpane.lower.commarea.buffer -side left -fill y
1568 +
1569 +# -- Diff Header
1570 +set ui_fname_value {}
1571 +set ui_fstatus_value {}
1572 +frame .vpane.lower.diff.header -background orange
1573 +label .vpane.lower.diff.header.l1 -text {File:} \
1574 + -background orange \
1575 + -font $mainfont
1576 +label .vpane.lower.diff.header.l2 -textvariable ui_fname_value \
1577 + -background orange \
1578 + -anchor w \
1579 + -justify left \
1580 + -font $mainfont
1581 +label .vpane.lower.diff.header.l3 -text {Status:} \
1582 + -background orange \
1583 + -font $mainfont
1584 +label .vpane.lower.diff.header.l4 -textvariable ui_fstatus_value \
1585 + -background orange \
1586 + -width $max_status_desc \
1587 + -anchor w \
1588 + -justify left \
1589 + -font $mainfont
1590 +pack .vpane.lower.diff.header.l1 -side left
1591 +pack .vpane.lower.diff.header.l2 -side left -fill x
1592 +pack .vpane.lower.diff.header.l4 -side right
1593 +pack .vpane.lower.diff.header.l3 -side right
1594 +
1595 +# -- Diff Body
1596 +frame .vpane.lower.diff.body
1597 +set ui_diff .vpane.lower.diff.body.t
1598 +text $ui_diff -background white -borderwidth 0 \
1599 + -width 80 -height 15 -wrap none \
1600 + -font $difffont \
1601 + -xscrollcommand {.vpane.lower.diff.body.sbx set} \
1602 + -yscrollcommand {.vpane.lower.diff.body.sby set} \
1603 + -cursor $maincursor \
1604 + -state disabled
1605 +scrollbar .vpane.lower.diff.body.sbx -orient horizontal \
1606 + -command [list $ui_diff xview]
1607 +scrollbar .vpane.lower.diff.body.sby -orient vertical \
1608 + -command [list $ui_diff yview]
1609 +pack .vpane.lower.diff.body.sbx -side bottom -fill x
1610 +pack .vpane.lower.diff.body.sby -side right -fill y
1611 +pack $ui_diff -side left -fill both -expand 1
1612 +pack .vpane.lower.diff.header -side top -fill x
1613 +pack .vpane.lower.diff.body -side bottom -fill both -expand 1
1614 +
1615 +$ui_diff tag conf dm -foreground red
1616 +$ui_diff tag conf dp -foreground blue
1617 +$ui_diff tag conf da -font [concat $difffont bold]
1618 +$ui_diff tag conf di -foreground "#00a000"
1619 +$ui_diff tag conf dni -foreground "#a000a0"
1620 +$ui_diff tag conf bold -font [concat $difffont bold]
1621
1622 # -- Status Bar
1623 set ui_status_value {Initializing...}