diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | library/console.tcl | 45 |
2 files changed, 34 insertions, 15 deletions
@@ -1,3 +1,7 @@ +2007-10-12 Pat Thoyts <patthoyts@users.sourceforge.net> + + * library/console.tcl: Use TkFixedFont and ttk widgets + 2007-10-12 Daniel Steffen <das@users.sourceforge.net> * macosx/tkMacOSXDraw.c: replace all (internal) use of QD region 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 |