diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2007-10-12 09:28:28 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2007-10-12 09:28:28 (GMT) |
commit | 18f54d77cde108f63f96c93cee5b8171d9d9fc1f (patch) | |
tree | 4bbe9513a296ef39afd5036653097dd17d92b260 /library | |
parent | acc2acbb288f8a715cce7905093615b3a7fcbc47 (diff) | |
download | tk-18f54d77cde108f63f96c93cee5b8171d9d9fc1f.zip tk-18f54d77cde108f63f96c93cee5b8171d9d9fc1f.tar.gz tk-18f54d77cde108f63f96c93cee5b8171d9d9fc1f.tar.bz2 |
Make use of TkFixedFont and ttk widgets in the console. Try and select a better fixed font just for the console.
Diffstat (limited to 'library')
-rw-r--r-- | library/console.tcl | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/library/console.tcl b/library/console.tcl index 5ff9772..9b9615b 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -4,7 +4,7 @@ # can be used by non-unix systems that do not have built-in support # for shells. # -# RCS: @(#) $Id: console.tcl,v 1.31 2006/01/25 18:22:04 dgp Exp $ +# RCS: @(#) $Id: console.tcl,v 1.32 2007/10/12 09:28:29 patthoyts Exp $ # # Copyright (c) 1995-1997 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. @@ -98,20 +98,35 @@ proc ::tk::ConsoleInit {} { . configure -menu .menubar - set con [text .console -yscrollcommand [list .sb set] -setgrid true] - scrollbar .sb -command [list $con yview] - pack .sb -side right -fill both - pack $con -fill both -expand 1 -side left - switch -exact $tcl_platform(platform) { - "windows" { - $con configure -font systemfixed - } - "unix" { - if {[tk windowingsystem] eq "aqua"} { - $con configure -font {Monaco 9 normal} -highlightthickness 0 - } - } - } + # See if we can find a better font than the TkFixedFont + font create TkConsoleFont {*}[font configure TkFixedFont] + set families [font families] + switch -exact -- [tk windowingsystem] { + aqua { set preferred {Monaco 9} } + win32 { set preferred {ProFontWindows 8 Consolas 8} } + default { set preferred {} } + } + foreach {family size} $preferred { + if {[lsearch -exact $families $family] != -1} { + font configure TkConsoleFont -family $family -size $size + break + } + } + + # Provide the right border for the text widget (platform dependent). + ::ttk::style layout ConsoleFrame { + Entry.field -sticky news -border 1 -children { + ConsoleFrame.padding -sticky news + } + } + ::ttk::frame .consoleframe -style ConsoleFrame + + set con [text .console -yscrollcommand [list .sb set] -setgrid true \ + -borderwidth 0 -highlightthickness 0 -font TkConsoleFont] + ::ttk::scrollbar .sb -command [list $con yview] + pack .sb -in .consoleframe -fill both -side right -padx 1 -pady 1 + pack $con -in .consoleframe -fill both -expand 1 -side left -padx 1 -pady 1 + pack .consoleframe -fill both -expand 1 -side left ConsoleBind $con |