Skip to content

Commit b9f6b82

Browse files
committed
gitk: make configuration dialog resizing useful
gitk's configuration dialog can be resized, but this does not expand the space allocated to any widgets. Some items may have long lines of text that would be visible if the widgets expanded, but this does not happen. The top-level container uses a two column grid and allocates any space change equally to both columns. However, the configuration pages are contained in one cell so half the additional space is wasted if expanding. Also, the individual configuration pages do not mark any column or widgets to expand, so any additional space given is just used as padding. Collapse the top-level page to have one column, placing the "OK" and "Cancel" buttons in a non-resizing frame in column 1 (this keeps the buttons in constant geometry as the dialog is expanded). This makes all additional space go to the configuration page. Mark column 3 of the individual pages to get all additional space, and mark the text widgets in that column so they will expand to use the space. While we're at it, eliminate or simplify use of frames to contain column 2 content, and harmonize the indents of that content. prefspage_general adds a special "spacer" label in row 2, column 1, that causes all of the subsequent rows with no column 1 content to indent, and this carries over to the next notebook tab (prefspage_color) through some undocumented feature. The fonts page has a different indent, again for unknown reason. The documented approach would be to use -padx explicitly on all the rows to set the indents. Signed-off-by: Mark Levedahl <[email protected]>
1 parent c0932ed commit b9f6b82

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

gitk

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11567,9 +11567,10 @@ proc mkfontdisp {font top which} {
1156711567
set fontpref($font) [set $font]
1156811568
ttk::button $top.${font}but -text $which \
1156911569
-command [list choosefont $font $which]
11570-
ttk::label $top.$font -relief flat -font $font \
11571-
-text $fontattr($font,family) -justify left
11570+
ttk::label $top.$font -font $font \
11571+
-text $fontattr($font,family)
1157211572
grid x $top.${font}but $top.$font -sticky w
11573+
grid configure $top.$font -sticky ew
1157311574
}
1157411575
1157511576
proc centertext {w} {
@@ -11665,11 +11666,9 @@ proc prefspage_general {notebook} {
1166511666
grid x $page.hideremotes -sticky w
1166611667
1166711668
ttk::entry $page.refstohide -textvariable refstohide
11668-
ttk::frame $page.refstohidef
11669-
ttk::label $page.refstohidef.l -text [mc "Refs to hide (space-separated globs)" ]
11670-
pack $page.refstohidef.l -side left
11671-
pack configure $page.refstohidef.l -padx 10
11672-
grid x $page.refstohidef $page.refstohide -sticky ew
11669+
ttk::label $page.refstohidel -text [mc "Refs to hide (space-separated globs)"]
11670+
grid x $page.refstohidel $page.refstohide -sticky ew
11671+
grid configure $page.refstohide -padx {0 5}
1167311672
1167411673
ttk::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
1167511674
-variable autocopy
@@ -11718,16 +11717,17 @@ proc prefspage_general {notebook} {
1171811717
ttk::frame $page.extdifff
1171911718
ttk::label $page.extdifff.l -text [mc "External diff tool" ]
1172011719
ttk::button $page.extdifff.b -text [mc "Choose..."] -command choose_extdiff
11721-
pack $page.extdifff.l $page.extdifff.b -side left
11722-
pack configure $page.extdifff.l -padx 10
11720+
pack $page.extdifff.l -side left
11721+
pack $page.extdifff.b -side right -padx {0 5}
1172311722
grid x $page.extdifff $page.extdifft -sticky ew
11723+
grid configure $page.extdifft -padx {0 5}
1172411724
1172511725
ttk::entry $page.webbrowser -textvariable web_browser
11726-
ttk::frame $page.webbrowserf
11727-
ttk::label $page.webbrowserf.l -text [mc "Web browser" ]
11728-
pack $page.webbrowserf.l -side left
11729-
pack configure $page.webbrowserf.l -padx 10
11730-
grid x $page.webbrowserf $page.webbrowser -sticky ew
11726+
ttk::label $page.webbrowserl -text [mc "Web browser" ]
11727+
grid x $page.webbrowserl $page.webbrowser -sticky ew
11728+
grid configure $page.webbrowser -padx {0 5}
11729+
11730+
grid columnconfigure $page 2 -weight 1
1173111731
1173211732
return $page
1173311733
}
@@ -11751,9 +11751,11 @@ proc prefspage_colors {notebook} {
1175111751
ttk::label $page.tloadframe.l -text [mc "Theme definition file"]
1175211752
ttk::button $page.tloadframe.b -text [mc "Choose..."] \
1175311753
-command [list choose_themeloader $page]
11754-
pack $page.tloadframe.l $page.tloadframe.b -side left -padx 2
11754+
pack $page.tloadframe.l -side left
11755+
pack $page.tloadframe.b -side right -padx {0 5}
1175511756
pack configure $page.tloadframe.l -padx 0
1175611757
grid x $page.tloadframe $page.tloadvar -sticky ew
11758+
grid configure $page.tloadvar -padx {0 5}
1175711759
1175811760
ttk::label $page.themelabel2 -text \
1175911761
[mc "The theme definition file may affect all themes."]
@@ -11799,6 +11801,9 @@ proc prefspage_colors {notebook} {
1179911801
ttk::button $page.selbgbut -text [mc "Select bg"] \
1180011802
-command [list choosecolor selectbgcolor {} $page [mc "background"]]
1180111803
grid x $page.selbgbut $page.selbgsep -sticky w
11804+
11805+
grid columnconfigure $page 2 -weight 1
11806+
1180211807
return $page
1180311808
}
1180411809
@@ -11824,6 +11829,7 @@ proc prefspage_fonts {notebook} {
1182411829
mkfontdisp mainfont $page [mc "Main font"]
1182511830
mkfontdisp textfont $page [mc "Diff display font"]
1182611831
mkfontdisp uifont $page [mc "User interface font"]
11832+
grid columnconfigure $page 2 -weight 1
1182711833
return $page
1182811834
}
1182911835
@@ -11858,7 +11864,7 @@ proc doprefs {} {
1185811864
grid rowconfigure $notebook 1 -weight 1
1185911865
raise [lindex $pages 0]
1186011866
11861-
grid $notebook -sticky news -padx 2 -pady 2
11867+
grid $notebook -sticky news -padx 3 -pady 3
1186211868
grid rowconfigure $top 0 -weight 1
1186311869
grid columnconfigure $top 0 -weight 1
1186411870
@@ -11867,11 +11873,8 @@ proc doprefs {} {
1186711873
ttk::button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
1186811874
bind $top <Key-Return> prefsok
1186911875
bind $top <Key-Escape> prefscan
11870-
grid $top.buts.ok $top.buts.can
11871-
grid columnconfigure $top.buts 0 -weight 1 -uniform a
11872-
grid columnconfigure $top.buts 1 -weight 1 -uniform a
11873-
grid $top.buts - - -pady 10 -sticky ew
11874-
grid columnconfigure $top 2 -weight 1
11876+
grid $top.buts.ok $top.buts.can -padx 20
11877+
grid $top.buts -sticky w -pady 10
1187511878
bind $top <Visibility> [list focus $top.buts.ok]
1187611879
}
1187711880

0 commit comments

Comments
 (0)