@@ -435,56 +435,59 @@ proc makewindow {} {
435435 .bar.help configure -font $uifont
436436 . configure -menu .bar
437437
438- if {![info exists geometry(canv1)]} {
439- set geometry(canv1) [expr {45 * $charspc }]
440- set geometry(canv2) [expr {30 * $charspc }]
441- set geometry(canv3) [expr {15 * $charspc }]
442- set geometry(canvh) [expr {25 * $linespc + 4}]
443- set geometry(ctextw) 80
444- set geometry(ctexth) 30
445- set geometry(cflistw) 30
446- }
438+ # the gui has upper and lower half, parts of a paned window.
447439 panedwindow .ctop -orient vertical
448- if {[info exists geometry(width)]} {
449- .ctop conf -width $geometry(width) -height $geometry(height)
450- set texth [expr {$geometry(height) - $geometry(canvh) - 56}]
451- set geometry(ctexth) [expr {($texth - 8) /
452- [font metrics $textfont -linespace]}]
453- }
454- frame .ctop.top
455- frame .ctop.top.bar
456- frame .ctop.top.lbar
457- pack .ctop.top.lbar -side bottom -fill x
458- pack .ctop.top.bar -side bottom -fill x
459- set cscroll .ctop.top.csb
460- scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0
461- pack $cscroll -side right -fill y
462- panedwindow .ctop.top.clist -orient horizontal -sashpad 0 -handlesize 4
463- pack .ctop.top.clist -side top -fill both -expand 1
464- .ctop add .ctop.top
465- set canv .ctop.top.clist.canv
466- canvas $canv -height $geometry(canvh) -width $geometry(canv1) \
440+
441+ # possibly use assumed geometry
442+ if {![info exists geometry(topheight)]} {
443+ set geometry(topheight) [expr {15 * $linespc }]
444+ set geometry(topwidth) [expr {80 * $charspc }]
445+ set geometry(botheight) [expr {15 * $linespc }]
446+ set geometry(botwidth) [expr {50 * $charspc }]
447+ set geometry(canv) [expr {40 * $charspc }]
448+ set geometry(canv2) [expr {20 * $charspc }]
449+ set geometry(canv3) [expr {20 * $charspc }]
450+ }
451+
452+ # the upper half will have a paned window, a scroll bar to the right, and some stuff below
453+ frame .tf -height $geometry(topheight) -width $geometry(topwidth)
454+ frame .tf.histframe
455+ panedwindow .tf.histframe.pwclist -orient horizontal -sashpad 0 -handlesize 4
456+
457+ # create three canvases
458+ set cscroll .tf.histframe.csb
459+ set canv .tf.histframe.pwclist.canv
460+ canvas $canv -width $geometry(canv) \
467461 -background $bgcolor -bd 0 \
468462 -yscrollincr $linespc -yscrollcommand " scrollcanv $cscroll "
469- .ctop.top.clist add $canv
470- set canv2 .ctop.top.clist .canv2
471- canvas $canv2 -height $geometry(canvh) - width $geometry(canv2) \
463+ .tf.histframe.pwclist add $canv
464+ set canv2 .tf.histframe.pwclist .canv2
465+ canvas $canv2 -width $geometry(canv2) \
472466 -background $bgcolor -bd 0 -yscrollincr $linespc
473- .ctop.top.clist add $canv2
474- set canv3 .ctop.top.clist .canv3
475- canvas $canv3 -height $geometry(canvh) - width $geometry(canv3) \
467+ .tf.histframe.pwclist add $canv2
468+ set canv3 .tf.histframe.pwclist .canv3
469+ canvas $canv3 -width $geometry(canv3) \
476470 -background $bgcolor -bd 0 -yscrollincr $linespc
477- .ctop.top.clist add $canv3
478- bind .ctop.top.clist <Configure> {resizeclistpanes %W %w}
471+ .tf.histframe.pwclist add $canv3
472+
473+ # a scroll bar to rule them
474+ scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0
475+ pack $cscroll -side right -fill y
476+ bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w}
479477 lappend bglist $canv $canv2 $canv3
478+ pack .tf.histframe.pwclist -fill both -expand 1 -side left
480479
481- set sha1entry .ctop.top.bar.sha1
480+ # we have two button bars at bottom of top frame. Bar 1
481+ frame .tf.bar
482+ frame .tf.lbar -height 15
483+
484+ set sha1entry .tf.bar.sha1
482485 set entries $sha1entry
483- set sha1but .ctop.top .bar.sha1label
486+ set sha1but .tf .bar.sha1label
484487 button $sha1but -text " SHA1 ID: " -state disabled -relief flat \
485488 -command gotocommit -width 8 -font $uifont
486489 $sha1but conf -disabledforeground [$sha1but cget -foreground]
487- pack .ctop.top .bar.sha1label -side left
490+ pack .tf .bar.sha1label -side left
488491 entry $sha1entry -width 40 -font $textfont -textvariable sha1string
489492 trace add variable sha1string write sha1change
490493 pack $sha1entry -side left -pady 2
@@ -505,91 +508,105 @@ proc makewindow {} {
505508 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,
506509 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};
507510 }
508- button .ctop.top .bar.leftbut -image bm-left -command goback \
511+ button .tf .bar.leftbut -image bm-left -command goback \
509512 -state disabled -width 26
510- pack .ctop.top .bar.leftbut -side left -fill y
511- button .ctop.top .bar.rightbut -image bm-right -command goforw \
513+ pack .tf .bar.leftbut -side left -fill y
514+ button .tf .bar.rightbut -image bm-right -command goforw \
512515 -state disabled -width 26
513- pack .ctop.top .bar.rightbut -side left -fill y
516+ pack .tf .bar.rightbut -side left -fill y
514517
515- button .ctop.top .bar.findbut -text " Find" -command dofind -font $uifont
516- pack .ctop.top .bar.findbut -side left
518+ button .tf .bar.findbut -text " Find" -command dofind -font $uifont
519+ pack .tf .bar.findbut -side left
517520 set findstring {}
518- set fstring .ctop.top .bar.findstring
521+ set fstring .tf .bar.findstring
519522 lappend entries $fstring
520523 entry $fstring -width 30 -font $textfont -textvariable findstring
521524 trace add variable findstring write find_change
522- pack $fstring -side left -expand 1 -fill x
525+ pack $fstring -side left -expand 1 -fill x -in .tf.bar
523526 set findtype Exact
524- set findtypemenu [tk_optionMenu .ctop.top .bar.findtype \
525- findtype Exact IgnCase Regexp]
527+ set findtypemenu [tk_optionMenu .tf .bar.findtype \
528+ findtype Exact IgnCase Regexp]
526529 trace add variable findtype write find_change
527- .ctop.top .bar.findtype configure -font $uifont
528- .ctop.top .bar.findtype.menu configure -font $uifont
530+ .tf .bar.findtype configure -font $uifont
531+ .tf .bar.findtype.menu configure -font $uifont
529532 set findloc " All fields"
530- tk_optionMenu .ctop.top .bar.findloc findloc " All fields" Headline \
533+ tk_optionMenu .tf .bar.findloc findloc " All fields" Headline \
531534 Comments Author Committer
532535 trace add variable findloc write find_change
533- .ctop.top.bar.findloc configure -font $uifont
534- .ctop.top.bar.findloc.menu configure -font $uifont
535- pack .ctop.top.bar.findloc -side right
536- pack .ctop.top.bar.findtype -side right
537-
538- label .ctop.top.lbar.flabel -text " Highlight: Commits " \
539- -font $uifont
540- pack .ctop.top.lbar.flabel -side left -fill y
536+ .tf.bar.findloc configure -font $uifont
537+ .tf.bar.findloc.menu configure -font $uifont
538+ pack .tf.bar.findloc -side right
539+ pack .tf.bar.findtype -side right
540+
541+ # build up the bottom bar of upper window
542+ label .tf.lbar.flabel -text " Highlight: Commits " \
543+ -font $uifont
544+ pack .tf.lbar.flabel -side left -fill y
541545 set gdttype " touching paths:"
542- set gm [tk_optionMenu .ctop.top .lbar.gdttype gdttype " touching paths:" \
543- " adding/removing string:" ]
546+ set gm [tk_optionMenu .tf .lbar.gdttype gdttype " touching paths:" \
547+ " adding/removing string:" ]
544548 trace add variable gdttype write hfiles_change
545549 $gm conf -font $uifont
546- .ctop.top .lbar.gdttype conf -font $uifont
547- pack .ctop.top .lbar.gdttype -side left -fill y
548- entry .ctop.top .lbar.fent -width 25 -font $textfont \
550+ .tf .lbar.gdttype conf -font $uifont
551+ pack .tf .lbar.gdttype -side left -fill y
552+ entry .tf .lbar.fent -width 25 -font $textfont \
549553 -textvariable highlight_files
550554 trace add variable highlight_files write hfiles_change
551- lappend entries .ctop.top .lbar.fent
552- pack .ctop.top .lbar.fent -side left -fill x -expand 1
553- label .ctop.top .lbar.vlabel -text " OR in view" -font $uifont
554- pack .ctop.top .lbar.vlabel -side left -fill y
555+ lappend entries .tf .lbar.fent
556+ pack .tf .lbar.fent -side left -fill x -expand 1
557+ label .tf .lbar.vlabel -text " OR in view" -font $uifont
558+ pack .tf .lbar.vlabel -side left -fill y
555559 global viewhlmenu selectedhlview
556- set viewhlmenu [tk_optionMenu .ctop.top .lbar.vhl selectedhlview None]
560+ set viewhlmenu [tk_optionMenu .tf .lbar.vhl selectedhlview None]
557561 $viewhlmenu entryconf None -command delvhighlight
558562 $viewhlmenu conf -font $uifont
559- .ctop.top .lbar.vhl conf -font $uifont
560- pack .ctop.top .lbar.vhl -side left -fill y
561- label .ctop.top .lbar.rlabel -text " OR " -font $uifont
562- pack .ctop.top .lbar.rlabel -side left -fill y
563+ .tf .lbar.vhl conf -font $uifont
564+ pack .tf .lbar.vhl -side left -fill y
565+ label .tf .lbar.rlabel -text " OR " -font $uifont
566+ pack .tf .lbar.rlabel -side left -fill y
563567 global highlight_related
564- set m [tk_optionMenu .ctop.top .lbar.relm highlight_related None \
565- " Descendent" " Not descendent" " Ancestor" " Not ancestor" ]
568+ set m [tk_optionMenu .tf .lbar.relm highlight_related None \
569+ " Descendent" " Not descendent" " Ancestor" " Not ancestor" ]
566570 $m conf -font $uifont
567- .ctop.top .lbar.relm conf -font $uifont
571+ .tf .lbar.relm conf -font $uifont
568572 trace add variable highlight_related write vrel_change
569- pack .ctop.top.lbar.relm -side left -fill y
570-
571- panedwindow .ctop.cdet -orient horizontal
572- .ctop add .ctop.cdet
573- frame .ctop.cdet.left
574- frame .ctop.cdet.left.bot
575- pack .ctop.cdet.left.bot -side bottom -fill x
576- button .ctop.cdet.left.bot.search -text " Search" -command dosearch \
573+ pack .tf.lbar.relm -side left -fill y
574+
575+ # Finish putting the upper half of the viewer together
576+ pack .tf.lbar -in .tf -side bottom -fill x
577+ pack .tf.bar -in .tf -side bottom -fill x
578+ pack .tf.histframe -fill both -side top -expand 1
579+ .ctop add .tf
580+
581+ # now build up the bottom
582+ panedwindow .pwbottom -orient horizontal
583+
584+ # lower left, a text box over search bar, scroll bar to the right
585+ # if we know window height, then that will set the lower text height, otherwise
586+ # we set lower text height which will drive window height
587+ if {[info exists geometry(main)]} {
588+ frame .bleft -width $geometry(botwidth)
589+ } else {
590+ frame .bleft -width $geometry(botwidth) -height $geometry(botheight)
591+ }
592+ frame .bleft.top
593+
594+ button .bleft.top.search -text " Search" -command dosearch \
577595 -font $uifont
578- pack .ctop.cdet.left.bot .search -side left -padx 5
579- set sstring .ctop.cdet.left.bot .sstring
596+ pack .bleft.top .search -side left -padx 5
597+ set sstring .bleft.top .sstring
580598 entry $sstring -width 20 -font $textfont -textvariable searchstring
581599 lappend entries $sstring
582600 trace add variable searchstring write incrsearch
583601 pack $sstring -side left -expand 1 -fill x
584- set ctext .ctop.cdet.left .ctext
602+ set ctext .bleft .ctext
585603 text $ctext -background $bgcolor -foreground $fgcolor \
586604 -state disabled -font $textfont \
587- -width $geometry(ctextw) -height $geometry(ctexth) \
588605 -yscrollcommand scrolltext -wrap none
589- scrollbar .ctop.cdet.left.sb -command " $ctext yview"
590- pack .ctop.cdet.left.sb -side right -fill y
606+ scrollbar .bleft.sb -command " $ctext yview"
607+ pack .bleft.top -side top -fill x
608+ pack .bleft.sb -side right -fill y
591609 pack $ctext -side left -fill both -expand 1
592- .ctop.cdet add .ctop.cdet.left
593610 lappend bglist $ctext
594611 lappend fglist $ctext
595612
@@ -620,36 +637,45 @@ proc makewindow {} {
620637 $ctext tag conf msep -font [concat $textfont bold]
621638 $ctext tag conf found -back yellow
622639
623- frame .ctop.cdet.right
624- frame .ctop.cdet.right.mode
625- radiobutton .ctop.cdet.right.mode.patch -text " Patch" \
640+ .pwbottom add .bleft
641+
642+ # lower right
643+ frame .bright
644+ frame .bright.mode
645+ radiobutton .bright.mode.patch -text " Patch" \
626646 -command reselectline -variable cmitmode -value " patch"
627- radiobutton .ctop.cdet.right .mode.tree -text " Tree" \
647+ radiobutton .bright .mode.tree -text " Tree" \
628648 -command reselectline -variable cmitmode -value " tree"
629- grid .ctop.cdet.right. mode.patch .ctop.cdet.right .mode.tree -sticky ew
630- pack .ctop.cdet.right .mode -side top -fill x
631- set cflist .ctop.cdet.right .cfiles
649+ grid .bright. mode.patch .bright .mode.tree -sticky ew
650+ pack .bright .mode -side top -fill x
651+ set cflist .bright .cfiles
632652 set indent [font measure $mainfont " nn" ]
633- text $cflist -width $geometry(cflistw) \
653+ text $cflist \
634654 -background $bgcolor -foreground $fgcolor \
635655 -font $mainfont \
636656 -tabs [list $indent [expr {2 * $indent }]] \
637- -yscrollcommand " .ctop.cdet.right .sb set" \
657+ -yscrollcommand " .bright .sb set" \
638658 -cursor [. cget -cursor] \
639659 -spacing1 1 -spacing3 1
640660 lappend bglist $cflist
641661 lappend fglist $cflist
642- scrollbar .ctop.cdet.right .sb -command " $cflist yview"
643- pack .ctop.cdet.right .sb -side right -fill y
662+ scrollbar .bright .sb -command " $cflist yview"
663+ pack .bright .sb -side right -fill y
644664 pack $cflist -side left -fill both -expand 1
645665 $cflist tag configure highlight \
646666 -background [$cflist cget -selectbackground]
647667 $cflist tag configure bold -font [concat $mainfont bold]
648- .ctop.cdet add .ctop.cdet.right
649- bind .ctop.cdet <Configure> {resizecdetpanes %W %w}
650668
651- pack .ctop -side top -fill both -expand 1
669+ .pwbottom add .bright
670+ .ctop add .pwbottom
652671
672+ # restore window position if known
673+ if {[info exists geometry(main)]} {
674+ wm geometry . " $geometry(main) "
675+ }
676+
677+ bind .pwbottom <Configure> {resizecdetpanes %W %w}
678+ pack .ctop -fill both -expand 1
653679 bindall <1> {selcanvline %W %x %y}
654680 # bindall <B1-Motion> {selcanvline %W %x %y}
655681 bindall <ButtonRelease-4> " allcanvs yview scroll -5 units"
@@ -802,18 +828,16 @@ proc savestuff {w} {
802828 puts $f [list set fgcolor $fgcolor ]
803829 puts $f [list set colors $colors ]
804830 puts $f [list set diffcolors $diffcolors ]
805- puts $f " set geometry(width) [ winfo width .ctop] "
806- puts $f " set geometry(height) [ winfo height .ctop] "
807- puts $f " set geometry(canv1) [ expr {[winfo width $canv ] -2}]"
808- puts $f " set geometry(canv2) [ expr {[winfo width $canv2 ] -2}]"
809- puts $f " set geometry(canv3) [ expr {[winfo width $canv3 ] -2}]"
810- puts $f " set geometry(canvh) [ expr {[winfo height $canv ] -2}]"
811- set wid [expr {([winfo width $ctext ] - 8) \
812- / [font measure $textfont " 0" ]}]
813- puts $f " set geometry(ctextw) $wid "
814- set wid [expr {([winfo width $cflist ] - 11) \
815- / [font measure [$cflist cget -font] " 0" ]}]
816- puts $f " set geometry(cflistw) $wid "
831+
832+ puts $f " set geometry(main) [ winfo geometry .] "
833+ puts $f " set geometry(topwidth) [ winfo width .tf] "
834+ puts $f " set geometry(topheight) [ winfo height .tf] "
835+ puts $f " set geometry(canv) [ expr {[winfo width $canv ] -0}]"
836+ puts $f " set geometry(canv2) [ expr {[winfo width $canv2 ] -0}]"
837+ puts $f " set geometry(canv3) [ expr {[winfo width $canv3 ] -0}]"
838+ puts $f " set geometry(botwidth) [ winfo width .bleft] "
839+ puts $f " set geometry(botheight) [ winfo height .bleft] "
840+
817841 puts -nonewline $f " set permviews {"
818842 for {set v 0} {$v < $nextviewnum } {incr v} {
819843 if {$viewperm($v) } {
@@ -4043,11 +4067,11 @@ proc addtohistory {cmd} {
40434067 }
40444068 incr historyindex
40454069 if {$historyindex > 1} {
4046- .ctop.top .bar.leftbut conf -state normal
4070+ .tf .bar.leftbut conf -state normal
40474071 } else {
4048- .ctop.top .bar.leftbut conf -state disabled
4072+ .tf .bar.leftbut conf -state disabled
40494073 }
4050- .ctop.top .bar.rightbut conf -state disabled
4074+ .tf .bar.rightbut conf -state disabled
40514075}
40524076
40534077proc godo {elt} {
@@ -4067,10 +4091,10 @@ proc goback {} {
40674091 if {$historyindex > 1} {
40684092 incr historyindex -1
40694093 godo [lindex $history [expr {$historyindex - 1}]]
4070- .ctop.top .bar.rightbut conf -state normal
4094+ .tf .bar.rightbut conf -state normal
40714095 }
40724096 if {$historyindex <= 1} {
4073- .ctop.top .bar.leftbut conf -state disabled
4097+ .tf .bar.leftbut conf -state disabled
40744098 }
40754099}
40764100
@@ -4081,10 +4105,10 @@ proc goforw {} {
40814105 set cmd [lindex $history $historyindex ]
40824106 incr historyindex
40834107 godo $cmd
4084- .ctop.top .bar.leftbut conf -state normal
4108+ .tf .bar.leftbut conf -state normal
40854109 }
40864110 if {$historyindex >= [llength $history ]} {
4087- .ctop.top .bar.rightbut conf -state disabled
4111+ .tf .bar.rightbut conf -state disabled
40884112 }
40894113}
40904114
@@ -4591,7 +4615,7 @@ proc searchmarkvisible {doall} {
45914615proc scrolltext {f0 f1} {
45924616 global searchstring
45934617
4594- .ctop.cdet.left .sb set $f0 $f1
4618+ .bleft .sb set $f0 $f1
45954619 if {$searchstring ne {}} {
45964620 searchmarkvisible 0
45974621 }
0 commit comments