summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2007-10-12 09:28:28 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2007-10-12 09:28:28 (GMT)
commit18f54d77cde108f63f96c93cee5b8171d9d9fc1f (patch)
tree4bbe9513a296ef39afd5036653097dd17d92b260
parentacc2acbb288f8a715cce7905093615b3a7fcbc47 (diff)
downloadtk-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.
-rw-r--r--ChangeLog4
-rw-r--r--library/console.tcl45
2 files changed, 34 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index a937ad5..e7b68cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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