summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalCommonGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* Refactor: Prepare Ninja generator for multi-configKyle Edwards2019-12-131-2/+6
|
* cmLocalCommonGenerator: Mark GetConfigName as constBrad King2019-09-301-1/+1
|
* clang-tidy: Pass by valueRegina Pfeifer2019-01-221-1/+1
|
* Makefile,Ninja: De-duplicate ComputeObjectFilenames methodBrad King2018-01-291-0/+6
| | | | | Move the method implementation up to `cmLocalCommonGenerator` to avoid duplicating it in each generator.
* Use C++11 override instead of CM_OVERRIDEBrad King2017-09-151-2/+2
| | | | | | | | We now require C++11 support including `override`. Drop use of the old compatibility macro. Convert references as follows: git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' | xargs sed -i 's/CM_OVERRIDE/override/g'
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-1/+1
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* cmLocalCommonGenerator: Save CMAKE_BUILD_TYPE on constructionBrad King2017-05-151-1/+0
| | | | | | | | | | | | | | | Copy the value to our `ConfigName` member on construction to ensure it is available even to code paths that run before `Generate`. We once needed to delay this lookup until `Generate` because the local generators were at one time created before `Configure`. Now they are created at generate time which is late enough to expect `CMAKE_BUILD_TYPE` to be available. Without this, `cmGlobalUnixMakefileGenerator3::WriteConvenienceRules` causes use of `ConfigName` before it is populated which breaks use of source files that depend on the `$<CONFIG>` generator expression. Fixes: #16889
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-3/+2
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Common: Use a string instead of enum for WorkingDirectoryStephen Kelly2016-09-191-6/+3
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-1/+8
|
* mark functions with CM_OVERRIDEDaniel Pfeifer2016-06-271-2/+2
|
* cmLocalGenerator: Add method to get Fortran-specific compiler flagsBrad King2016-06-171-0/+3
| | | | | | | | | | Add a cmLocalGenerator::GetTargetFortranFlags virtual method to get generator-specific generation of Fortran-specific flags. Implement it in cmLocalCommonGenerator by moving the implementation from cmCommonTargetGenerator::AddFortranFlags. This will allow it to be used without having a target generator available. Inspired-by: Tobias Hunger <tobias.hunger@qt.io>
* Refactor Makefile/Ninja tool working directory storageBrad King2016-06-171-1/+9
| | | | | Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator and add an access method.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-1/+1
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* cmLocalGenerator: Create from already-constructed cmMakefile.Stephen Kelly2015-08-281-2/+1
| | | | Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
* cmLocalGenerator: Remove Parent pointer.Stephen Kelly2015-08-281-1/+0
|
* cmCommonTargetGenerator: Adopt ModuleDefinitionFile memberBrad King2015-07-091-0/+4
| | | | | De-duplicate the ModuleDefinitionFile and AddModuleDefinitionFlag members from the Makefile and Ninja target generators.
* cmLocalCommonGenerator: Adopt ConfigName memberBrad King2015-07-091-0/+6
| | | | De-duplicate the member from the local Makefile and Ninja generators.
* Add common base classes to Makefile and Ninja generatorsBrad King2015-07-091-0/+29
Provide a place to move functionality common to both.
option value='0' selected='selected'>unified
Diffstat
-rw-r--r--library/clrpick.tcl88
-rw-r--r--library/comdlg.tcl36
-rw-r--r--library/console.tcl32
-rw-r--r--library/dialog.tcl8
-rw-r--r--library/entry.tcl64
-rw-r--r--library/focus.tcl6
-rw-r--r--library/listbox.tcl14
-rw-r--r--library/menu.tcl68
-rw-r--r--library/msgbox.tcl26
-rw-r--r--library/optMenu.tcl2
-rw-r--r--library/palette.tcl46
-rw-r--r--library/safetk.tcl104
-rw-r--r--library/scale.tcl20
-rw-r--r--library/scrlbar.tcl34
-rw-r--r--library/tclIndex3
-rw-r--r--library/tearoff.tcl2
-rw-r--r--library/text.tcl94
-rw-r--r--library/tk.tcl6
-rw-r--r--mac/tkMac.h37
-rw-r--r--mac/tkMacCursor.c34
-rw-r--r--mac/tkMacEmbed.c180
-rw-r--r--mac/tkMacInt.h18
-rw-r--r--mac/tkMacMenu.c37
-rw-r--r--mac/tkMacSubwindows.c114
-rw-r--r--mac/tkMacWindowMgr.c61
-rw-r--r--mac/tkMacWm.c34
-rw-r--r--mac/tkMacXStubs.c2
-rw-r--r--tests/safe.test47
-rw-r--r--win/tkWinWindow.c7
29 files changed, 802 insertions, 422 deletions
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index af5f980..a06b2e2 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -59,7 +59,7 @@ proc tkColorDialog {args} {
tkColorDialog_Config $w $args
tkColorDialog_InitValues $w
- if ![winfo exists $w] {
+ if {![winfo exists $w]} {
toplevel $w -class tkColorDialog
tkColorDialog_BuildDialog $w
}
@@ -72,10 +72,10 @@ proc tkColorDialog {args} {
wm withdraw $w
update idletasks
- set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
- - [winfo vrootx [winfo parent $w]]]
- set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
- - [winfo vrooty [winfo parent $w]]]
+ set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
+ - [winfo vrootx [winfo parent $w]]}]
+ set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
+ - [winfo vrooty [winfo parent $w]]}]
wm geom $w +$x+$y
wm deiconify $w
wm title $w $data(-title)
@@ -120,19 +120,19 @@ proc tkColorDialog_InitValues {w} {
# IntensityIncr is the difference in color intensity between a colorbar
# and its neighbors.
- set data(intensityIncr) [expr 256 / $data(NUM_COLORBARS)]
+ set data(intensityIncr) [expr {256 / $data(NUM_COLORBARS)}]
# ColorbarWidth is the width of each colorbar
set data(colorbarWidth) \
- [expr $data(BARS_WIDTH) / $data(NUM_COLORBARS)]
+ [expr {$data(BARS_WIDTH) / $data(NUM_COLORBARS)}]
# Indent is the width of the space at the left and right side of the
# colorbar. It is always half the selector polygon width, because the
# polygon extends into the space.
- set data(indent) [expr $data(PLGN_WIDTH) / 2]
+ set data(indent) [expr {$data(PLGN_WIDTH) / 2}]
set data(colorPad) 2
- set data(selPad) [expr $data(PLGN_WIDTH) / 2]
+ set data(selPad) [expr {$data(PLGN_WIDTH) / 2}]
#
# minX is the x coordinate of the first colorbar
@@ -142,13 +142,13 @@ proc tkColorDialog_InitValues {w} {
#
# maxX is the x coordinate of the last colorbar
#
- set data(maxX) [expr $data(BARS_WIDTH) + $data(indent)-1]
+ set data(maxX) [expr {$data(BARS_WIDTH) + $data(indent)-1}]
#
# canvasWidth is the width of the entire canvas, including the indents
#
- set data(canvasWidth) [expr $data(BARS_WIDTH) + \
- $data(PLGN_WIDTH)]
+ set data(canvasWidth) [expr {$data(BARS_WIDTH) + \
+ $data(PLGN_WIDTH)}]
# Set the initial color, specified by -initialcolor, or the
# color chosen by the user the last time.
@@ -156,9 +156,9 @@ proc tkColorDialog_InitValues {w} {
set data(finalColor) $data(-initialcolor)
set rgb [winfo rgb . $data(selection)]
- set data(red,intensity) [expr [lindex $rgb 0]/0x100]
- set data(green,intensity) [expr [lindex $rgb 1]/0x100]
- set data(blue,intensity) [expr [lindex $rgb 2]/0x100]
+ set data(red,intensity) [expr {[lindex $rgb 0]/0x100}]
+ set data(green,intensity) [expr {[lindex $rgb 1]/0x100}]
+ set data(blue,intensity) [expr {[lindex $rgb 2]/0x100}]
}
# tkColorDialog_Config --
@@ -181,10 +181,10 @@ proc tkColorDialog_Config {w argList} {
#
tclParseConfigSpec $w $specs "" $argList
- if ![string compare $data(-title) ""] {
+ if {![string compare $data(-title) ""]} {
set data(-title) " "
}
- if ![string compare $data(-initialcolor) ""] {
+ if {![string compare $data(-initialcolor) ""]} {
if {[info exists tkPriv(selectColor)] && \
[string compare $tkPriv(selectColor) ""]} {
set data(-initialcolor) $tkPriv(selectColor)
@@ -192,12 +192,12 @@ proc tkColorDialog_Config {w argList} {
set data(-initialcolor) [. cget -background]
}
} else {
- if [catch {winfo rgb . $data(-initialcolor)} err] {
+ if {[catch {winfo rgb . $data(-initialcolor)} err]} {
error $err
}
}
- if ![winfo exists $data(-parent)] {
+ if {![winfo exists $data(-parent)]} {
error "bad window path name \"$data(-parent)\""
}
}
@@ -233,8 +233,8 @@ proc tkColorDialog_BuildDialog {w} {
pack $box -side left -fill both
set height [expr \
- [winfo reqheight $box.entry] - \
- 2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd])]
+ {[winfo reqheight $box.entry] - \
+ 2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd])}]
canvas $f.color -height $height\
-width $data(BARS_WIDTH) -relief sunken -bd 2
@@ -341,7 +341,7 @@ proc tkColorDialog_SetRGBValue {w color} {
proc tkColorDialog_XToRgb {w x} {
upvar #0 $w data
- return [expr ($x * $data(intensityIncr))/ $data(colorbarWidth)]
+ return [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}]
}
# tkColorDialog_RgbToX
@@ -351,7 +351,7 @@ proc tkColorDialog_XToRgb {w x} {
proc tkColorDialog_RgbToX {w color} {
upvar #0 $w data
- return [expr ($color * $data(colorbarWidth)/ $data(intensityIncr))]
+ return [expr {($color * $data(colorbarWidth)/ $data(intensityIncr))}]
}
@@ -370,7 +370,7 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
set sel $data($c,sel)
# First handle the case that we are creating everything for the first time.
- if $create {
+ if {$create} {
# First remove all the lines that already exist.
if { $data(lines,$c,last) > $data(lines,$c,start)} {
for {set i $data(lines,$c,start)} \
@@ -379,7 +379,7 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
}
}
# Delete the selector if it exists
- if [info exists data($c,index)] {
+ if {[info exists data($c,index)]} {
$sel delete $data($c,index)
}
@@ -418,10 +418,10 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
# Draw the color bars.
set highlightW [expr \
- [$col cget -highlightthickness] + [$col cget -bd]]
+ {[$col cget -highlightthickness] + [$col cget -bd]}]
for {set i 0} { $i < $data(NUM_COLORBARS)} { incr i} {
- set intensity [expr $i * $data(intensityIncr)]
- set startx [expr $i * $data(colorbarWidth) + $highlightW]
+ set intensity [expr {$i * $data(intensityIncr)}]
+ set startx [expr {$i * $data(colorbarWidth) + $highlightW}]
if { $c == "red" } {
set color [format "#%02x%02x%02x" \
$intensity \
@@ -439,10 +439,10 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
$intensity]
}
- if $create {
+ if {$create} {
set index [$col create rect $startx $highlightW \
- [expr $startx +$data(colorbarWidth)] \
- [expr [winfo height $col] + $highlightW]\
+ [expr {$startx +$data(colorbarWidth)}] \
+ [expr {[winfo height $col] + $highlightW}]\
-fill $color -outline $color]
} else {
$col itemconf $l -fill $color -outline $color
@@ -451,9 +451,9 @@ proc tkColorDialog_DrawColorScale {w c {create 0}} {
}
$sel raise $data($c,index)
- if $create {
+ if {$create} {
set data(lines,$c,last) $index
- set data(lines,$c,start) [expr $index - $data(NUM_COLORBARS) + 1 ]
+ set data(lines,$c,start) [expr {$index - $data(NUM_COLORBARS) + 1}]
}
tkColorDialog_RedrawFinalColor $w
@@ -539,7 +539,7 @@ proc tkColorDialog_RedrawColorBars {w colorChanged} {
proc tkColorDialog_StartMove {w sel color x delta {dontMove 0}} {
upvar #0 $w data
- if !$dontMove {
+ if {!$dontMove} {
tkColorDialog_MoveSelector $w $sel $color $x $delta
}
}
@@ -561,11 +561,11 @@ proc tkColorDialog_MoveSelector {w sel color x delta} {
if { $x < 0 } {
set x 0
} elseif { $x >= $data(BARS_WIDTH)} {
- set x [expr $data(BARS_WIDTH) - 1]
+ set x [expr {$data(BARS_WIDTH) - 1}]
}
- set diff [expr $x - $data($color,x)]
+ set diff [expr {$x - $data($color,x)}]
$sel move $data($color,index) $diff 0
- set data($color,x) [expr $data($color,x) + $diff]
+ set data($color,x) [expr {$data($color,x) + $diff}]
# Return the x value that it was actually set at
return $x
@@ -617,14 +617,14 @@ proc tkColorDialog_HandleSelEntry {w} {
set text [string trim $data(selection)]
# Check to make sure that the color is valid
- if [catch {set color [winfo rgb . $text]} ] {
+ if {[catch {set color [winfo rgb . $text]} ]} {
set data(selection) $data(finalColor)
return
}
- set R [expr [lindex $color 0]/0x100]
- set G [expr [lindex $color 1]/0x100]
- set B [expr [lindex $color 2]/0x100]
+ set R [expr {[lindex $color 0]/0x100}]
+ set G [expr {[lindex $color 1]/0x100}]
+ set B [expr {[lindex $color 2]/0x100}]
tkColorDialog_SetRGBValue $w "$R $G $B"
set data(selection) $text
@@ -638,9 +638,9 @@ proc tkColorDialog_HandleRGBEntry {w} {
upvar #0 $w data
foreach c {red green blue} {
- if [catch {
- set data($c,intensity) [expr int($data($c,intensity))]
- }] {
+ if {[catch {
+ set data($c,intensity) [expr {int($data($c,intensity))}]
+ }]} {
set data($c,intensity) 0
}
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 4f00217..30e4c81 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -52,9 +52,9 @@ proc tclParseConfigSpec {w specs flags argList} {
set verproc($cmdsw) [lindex $spec 4]
}
- if {[expr [llength $argList] %2] != 0} {
+ if {([llength $argList]%2) != 0} {
foreach {cmdsw value} $argList {
- if ![info exists cmd($cmdsw)] {
+ if {![info exists cmd($cmdsw)]} {
error "unknown option \"$cmdsw\", must be [tclListValidFlags cmd]"
}
}
@@ -70,7 +70,7 @@ proc tclParseConfigSpec {w specs flags argList} {
# 3: parse the argument list
#
foreach {cmdsw value} $argList {
- if ![info exists cmd($cmdsw)] {
+ if {![info exists cmd($cmdsw)]} {
error "unknown option \"$cmdsw\", must be [tclListValidFlags cmd]"
}
set data($cmdsw) $value
@@ -137,10 +137,10 @@ proc tclVerifyInteger {string} {
#
proc tkFocusGroup_Create {t} {
global tkPriv
- if [string compare [winfo toplevel $t] $t] {
+ if {[string compare [winfo toplevel $t] $t]} {
error "$t is not a toplevel window"
}
- if ![info exists tkPriv(fg,$t)] {
+ if {![info exists tkPriv(fg,$t)]} {
set tkPriv(fg,$t) 1
set tkPriv(focus,$t) ""
bind $t <FocusIn> "tkFocusGroup_In $t %W %d"
@@ -156,7 +156,7 @@ proc tkFocusGroup_Create {t} {
#
proc tkFocusGroup_BindIn {t w cmd} {
global tkFocusIn tkPriv
- if ![info exists tkPriv(fg,$t)] {
+ if {![info exists tkPriv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
set tkFocusIn($t,$w) $cmd
@@ -171,7 +171,7 @@ proc tkFocusGroup_BindIn {t w cmd} {
#
proc tkFocusGroup_BindOut {t w cmd} {
global tkFocusOut tkPriv
- if ![info exists tkPriv(fg,$t)] {
+ if {![info exists tkPriv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
set tkFocusOut($t,$w) $cmd
@@ -185,7 +185,7 @@ proc tkFocusGroup_BindOut {t w cmd} {
proc tkFocusGroup_Destroy {t w} {
global tkPriv tkFocusIn tkFocusOut
- if ![string compare $t $w] {
+ if {![string compare $t $w]} {
unset tkPriv(fg,$t)
unset tkPriv(focus,$t)
@@ -196,8 +196,8 @@ proc tkFocusGroup_Destroy {t w} {
unset tkFocusOut($name)
}
} else {
- if [info exists tkPriv(focus,$t)] {
- if ![string compare $tkPriv(focus,$t) $w] {
+ if {[info exists tkPriv(focus,$t)]} {
+ if {![string compare $tkPriv(focus,$t) $w]} {
set tkPriv(focus,$t) ""
}
}
@@ -218,14 +218,14 @@ proc tkFocusGroup_Destroy {t w} {
proc tkFocusGroup_In {t w detail} {
global tkPriv tkFocusIn
- if ![info exists tkFocusIn($t,$w)] {
+ if {![info exists tkFocusIn($t,$w)]} {
set tkFocusIn($t,$w) ""
return
}
- if ![info exists tkPriv(focus,$t)] {
+ if {![info exists tkPriv(focus,$t)]} {
return
}
- if ![string compare $tkPriv(focus,$t) $w] {
+ if {![string compare $tkPriv(focus,$t) $w]} {
# This is already in focus
#
return
@@ -250,10 +250,10 @@ proc tkFocusGroup_Out {t w detail} {
# This is caused by mouse moving out of the window
return
}
- if ![info exists tkPriv(focus,$t)] {
+ if {![info exists tkPriv(focus,$t)]} {
return
}
- if ![info exists tkFocusOut($t,$w)] {
+ if {![info exists tkFocusOut($t,$w)]} {
return
} else {
eval $tkFocusOut($t,$w)
@@ -280,18 +280,18 @@ proc tkFDGetFileTypes {string} {
set label [lindex $t 0]
set exts {}
- if [info exists hasDoneType($label)] {
+ if {[info exists hasDoneType($label)]} {
continue
}
set name "$label ("
set sep ""
foreach ext $fileTypes($label) {
- if ![string compare $ext ""] {
+ if {![string compare $ext ""]} {
continue
}
regsub {^[.]} $ext "*." ext
- if ![info exists hasGotExt($label,$ext)] {
+ if {![info exists hasGotExt($label,$ext)]} {
append name $sep$ext
lappend exts $ext
set hasGotExt($label,$ext) 1
diff --git a/library/console.tcl b/library/console.tcl
index d2c28b2..673d842 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -108,7 +108,7 @@ proc tkConsoleSource {} {
-filetypes {{"Tcl Scripts" .tcl} {"All Files" *}}]
if {"$filename" != ""} {
set cmd [list source $filename]
- if [catch {consoleinterp eval $cmd} result] {
+ if {[catch {consoleinterp eval $cmd} result]} {
tkConsoleOutput stderr "$result\n"
}
}
@@ -136,7 +136,7 @@ proc tkConsoleInvoke {args} {
}
if {$cmd == ""} {
tkConsolePrompt
- } elseif [info complete $cmd] {
+ } elseif {[info complete $cmd]} {
.console mark set output end
.console tag delete input
set result [consoleinterp record $cmd]
@@ -168,7 +168,7 @@ proc tkConsoleHistory {cmd} {
prev {
incr histNum -1
if {$histNum == 0} {
- set cmd {history event [expr [history nextid] -1]}
+ set cmd {history event [expr {[history nextid] -1}]}
} else {
set cmd "history event $histNum"
}
@@ -182,7 +182,7 @@ proc tkConsoleHistory {cmd} {
next {
incr histNum
if {$histNum == 0} {
- set cmd {history event [expr [history nextid] -1]}
+ set cmd {history event [expr {[history nextid] -1}]}
} elseif {$histNum > 0} {
set cmd ""
set histNum 1
@@ -213,7 +213,7 @@ proc tkConsolePrompt {{partial normal}} {
if {$partial == "normal"} {
set temp [.console index "end - 1 char"]
.console mark set output end
- if [consoleinterp eval "info exists tcl_prompt1"] {
+ if {[consoleinterp eval "info exists tcl_prompt1"]} {
consoleinterp eval "eval \[set tcl_prompt1\]"
} else {
puts -nonewline "% "
@@ -221,7 +221,7 @@ proc tkConsolePrompt {{partial normal}} {
} else {
set temp [.console index output]
.console mark set output end
- if [consoleinterp eval "info exists tcl_prompt2"] {
+ if {[consoleinterp eval "info exists tcl_prompt2"]} {
consoleinterp eval "eval \[set tcl_prompt2\]"
} else {
puts -nonewline "> "
@@ -271,7 +271,7 @@ proc tkConsoleBind {win} {
if {[%W tag nextrange sel 1.0 end] != ""} {
%W tag remove sel sel.first promptEnd
} else {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
break
}
}
@@ -280,14 +280,14 @@ proc tkConsoleBind {win} {
if {[%W tag nextrange sel 1.0 end] != ""} {
%W tag remove sel sel.first promptEnd
} else {
- if [%W compare insert <= promptEnd] {
+ if {[%W compare insert <= promptEnd]} {
break
}
}
}
foreach left {Control-a Home} {
bind $win <$left> {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
tkTextSetCursor %W {insert linestart}
} else {
tkTextSetCursor %W promptEnd
@@ -302,32 +302,32 @@ proc tkConsoleBind {win} {
}
}
bind $win <Control-d> {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
break
}
}
bind $win <Control-k> {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
%W mark set insert promptEnd
}
}
bind $win <Control-t> {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
break
}
}
bind $win <Meta-d> {
- if [%W compare insert < promptEnd] {
+ if {[%W compare insert < promptEnd]} {
break
}
}
bind $win <Meta-BackSpace> {
- if [%W compare insert <= promptEnd] {
+ if {[%W compare insert <= promptEnd]} {
break
}
}
bind $win <Control-h> {
- if [%W compare insert <= promptEnd] {
+ if {[%W compare insert <= promptEnd]} {
break
}
}
@@ -353,7 +353,7 @@ proc tkConsoleBind {win} {
}
foreach left {Control-b Left} {
bind $win <$left> {
- if [%W compare insert == promptEnd] {
+ if {[%W compare insert == promptEnd]} {
break
}
tkTextSetCursor %W insert-1c
diff --git a/library/dialog.tcl b/library/dialog.tcl
index a9fcfa5..8be30ea 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -126,10 +126,10 @@ proc tk_dialog {w title text bitmap default args} {
wm withdraw $w
update idletasks
- set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
- - [winfo vrootx [winfo parent $w]]]
- set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
- - [winfo vrooty [winfo parent $w]]]
+ set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
+ - [winfo vrootx [winfo parent $w]]}]
+ set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
+ - [winfo vrooty [winfo parent $w]]}]
wm geom $w +$x+$y
wm deiconify $w
diff --git a/library/entry.tcl b/library/entry.tcl
index 4a0b764..3a86498 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -34,7 +34,7 @@
bind Entry <<Cut>> {
if {![catch {set data [string range [%W get] [%W index sel.first]\
- [expr [%W index sel.last] - 1]]}]} {
+ [expr {[%W index sel.last] - 1}]]}]} {
clipboard clear -displayof %W
clipboard append -displayof %W $data
%W delete sel.first sel.last
@@ -42,7 +42,7 @@ bind Entry <<Cut>> {
}
bind Entry <<Copy>> {
if {![catch {set data [string range [%W get] [%W index sel.first]\
- [expr [%W index sel.last] - 1]]}]} {
+ [expr {[%W index sel.last] - 1}]]}]} {
clipboard clear -displayof %W
clipboard append -displayof %W $data
}
@@ -115,17 +115,17 @@ bind Entry <ButtonRelease-2> {
}
bind Entry <Left> {
- tkEntrySetCursor %W [expr [%W index insert] - 1]
+ tkEntrySetCursor %W [expr {[%W index insert] - 1}]
}
bind Entry <Right> {
- tkEntrySetCursor %W [expr [%W index insert] + 1]
+ tkEntrySetCursor %W [expr {[%W index insert] + 1}]
}
bind Entry <Shift-Left> {
- tkEntryKeySelect %W [expr [%W index insert] - 1]
+ tkEntryKeySelect %W [expr {[%W index insert] - 1}]
tkEntrySeeInsert %W
}
bind Entry <Shift-Right> {
- tkEntryKeySelect %W [expr [%W index insert] + 1]
+ tkEntryKeySelect %W [expr {[%W index insert] + 1}]
tkEntrySeeInsert %W
}
bind Entry <Control-Left> {
@@ -158,7 +158,7 @@ bind Entry <Shift-End> {
}
bind Entry <Delete> {
- if [%W selection present] {
+ if {[%W selection present]} {
%W delete sel.first sel.last
} else {
%W delete insert
@@ -213,67 +213,67 @@ bind Entry <Insert> {
# Additional emacs-like bindings:
bind Entry <Control-a> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W 0
}
}
bind Entry <Control-b> {
- if !$tk_strictMotif {
- tkEntrySetCursor %W [expr [%W index insert] - 1]
+ if {!$tk_strictMotif} {
+ tkEntrySetCursor %W [expr {[%W index insert] - 1}]
}
}
bind Entry <Control-d> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert
}
}
bind Entry <Control-e> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W end
}
}
bind Entry <Control-f> {
- if !$tk_strictMotif {
- tkEntrySetCursor %W [expr [%W index insert] + 1]
+ if {!$tk_strictMotif} {
+ tkEntrySetCursor %W [expr {[%W index insert] + 1}]
}
}
bind Entry <Control-h> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntryBackspace %W
}
}
bind Entry <Control-k> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert end
}
}
bind Entry <Control-t> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntryTranspose %W
}
}
bind Entry <Meta-b> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W [tkEntryPreviousWord %W insert]
}
}
bind Entry <Meta-d> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert [tkEntryNextWord %W insert]
}
}
bind Entry <Meta-f> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W [tkEntryNextWord %W insert]
}
}
bind Entry <Meta-BackSpace> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete [tkEntryPreviousWord %W insert] insert
}
}
bind Entry <Meta-Delete> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete [tkEntryPreviousWord %W insert] insert
}
}
@@ -281,7 +281,7 @@ bind Entry <Meta-Delete> {
# A few additional bindings of my own.
bind Entry <2> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W scan mark %x
set tkPriv(x) %x
set tkPriv(y) %y
@@ -289,7 +289,7 @@ bind Entry <2> {
}
}
bind Entry <B2-Motion> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
if {abs(%x-$tkPriv(x)) > 2} {
set tkPriv(mouseMoved) 1
}
@@ -356,7 +356,7 @@ proc tkEntryMouseSelect {w x} {
}
switch $tkPriv(selectMode) {
char {
- if $tkPriv(mouseMoved) {
+ if {$tkPriv(mouseMoved)} {
if {$cur < $anchor} {
$w selection range $cur $anchor
} elseif {$cur > $anchor} {
@@ -369,10 +369,10 @@ proc tkEntryMouseSelect {w x} {
word {
if {$cur < [$w index anchor]} {
set before [tcl_wordBreakBefore [$w get] $cur]
- set after [tcl_wordBreakAfter [$w get] [expr $anchor-1]]
+ set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
} else {
set before [tcl_wordBreakBefore [$w get] $anchor]
- set after [tcl_wordBreakAfter [$w get] [expr $cur - 1]]
+ set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
}
if {$before < 0} {
set before 0
@@ -440,7 +440,7 @@ proc tkEntryAutoScan {w} {
# actually been moved to this position yet).
proc tkEntryKeySelect {w new} {
- if ![$w selection present] {
+ if {![$w selection present]} {
$w selection from insert
$w selection to $new
} else {
@@ -482,7 +482,7 @@ proc tkEntryInsert {w s} {
# w - The entry window in which to backspace.
proc tkEntryBackspace w {
- if [$w selection present] {
+ if {[$w selection present]} {
$w delete sel.first sel.last
} else {
set x [expr {[$w index insert] - 1}]
@@ -491,7 +491,7 @@ proc tkEntryBackspace w {
set range [$w xview]
set left [lindex $range 0]
set right [lindex $range 1]
- $w xview moveto [expr $left - ($right - $left)/2.0]
+ $w xview moveto [expr {$left - ($right - $left)/2.0}]
}
}
}
@@ -547,11 +547,11 @@ proc tkEntryTranspose w {
if {$i < [$w index end]} {
incr i
}
- set first [expr $i-2]
+ set first [expr {$i-2}]
if {$first < 0} {
return
}
- set new [string index [$w get] [expr $i-1]][string index [$w get] $first]
+ set new [string index [$w get] [expr {$i-1}]][string index [$w get] $first]
$w delete $first $i
$w insert insert $new
tkEntrySeeInsert $w
diff --git a/library/focus.tcl b/library/focus.tcl
index bf0476d..b4ff997 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -167,9 +167,9 @@ proc tk_focusFollowsMouse {} {
set script {
if {("%d" == "NotifyAncestor") || ("%d" == "NotifyNonlinear")
|| ("%d" == "NotifyInferior")} {
- if [tkFocusOK %W] {
- focus %W
- }
+ if {[tkFocusOK %W]} {
+ focus %W
+ }
}
}
if {$old != ""} {
diff --git a/library/listbox.tcl b/library/listbox.tcl
index 4e84b3a..ddaafa7 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -33,7 +33,7 @@
# makes that unnecessary.
bind Listbox <1> {
- if [winfo exists %W] {
+ if {[winfo exists %W]} {
tkListboxBeginSelect %W [%W index @%x,%y]
}
}
@@ -186,7 +186,7 @@ bind Listbox <B2-Motion> {
proc tkListboxBeginSelect {w el} {
global tkPriv
if {[$w cget -selectmode] == "multiple"} {
- if [$w selection includes $el] {
+ if {[$w selection includes $el]} {
$w selection clear $el
} else {
$w selection set $el
@@ -224,7 +224,7 @@ proc tkListboxMotion {w el} {
}
extended {
set i $tkPriv(listboxPrev)
- if [$w selection includes anchor] {
+ if {[$w selection includes anchor]} {
$w selection clear $i $el
$w selection set anchor $el
} else {
@@ -290,7 +290,7 @@ proc tkListboxBeginToggle {w el} {
set tkPriv(listboxSelection) [$w curselection]
set tkPriv(listboxPrev) $el
$w selection anchor $el
- if [$w selection includes $el] {
+ if {[$w selection includes $el]} {
$w selection clear $el
} else {
$w selection set $el
@@ -340,7 +340,7 @@ proc tkListboxAutoScan {w} {
proc tkListboxUpDown {w amount} {
global tkPriv
- $w activate [expr [$w index active] + $amount]
+ $w activate [expr {[$w index active] + $amount}]
$w see active
switch [$w cget -selectmode] {
browse {
@@ -371,7 +371,7 @@ proc tkListboxExtendUpDown {w amount} {
if {[$w cget -selectmode] != "extended"} {
return
}
- $w activate [expr [$w index active] + $amount]
+ $w activate [expr {[$w index active] + $amount}]
$w see active
tkListboxMotion $w [$w index active]
}
@@ -392,7 +392,7 @@ proc tkListboxDataExtend {w el} {
if {$mode == "extended"} {
$w activate $el
$w see $el
- if [$w selection includes anchor] {
+ if {[$w selection includes anchor]} {
tkListboxMotion $w $el
}
} elseif {$mode == "multiple"} {
diff --git a/library/menu.tcl b/library/menu.tcl
index 21b69d9..b0fa2cc 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -218,7 +218,7 @@ proc tkMbLeave w {
global tkPriv
set tkPriv(inMenubutton) {}
- if ![winfo exists $w] {
+ if {![winfo exists $w]} {
return
}
if {[$w cget -state] == "active"} {
@@ -273,29 +273,29 @@ proc tkMbPost {w {x {}} {y {}}} {
# the menu just below the menubutton, as for a pull-down.
update idletasks
- if [catch {
+ if {[catch {
switch [$w cget -direction] {
above {
set x [winfo rootx $w]
- set y [expr [winfo rooty $w] - [winfo reqheight $menu]]
+ set y [expr {[winfo rooty $w] - [winfo reqheight $menu]}]
$menu post $x $y
}
below {
set x [winfo rootx $w]
- set y [expr [winfo rooty $w] + [winfo height $w]]
+ set y [expr {[winfo rooty $w] + [winfo height $w]}]
$menu post $x $y
}
left {
- set x [expr [winfo rootx $w] - [winfo reqwidth $menu]]
- set y [expr (2 * [winfo rooty $w] + [winfo height $w]) / 2]
+ set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}]
+ set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [tkMenuFindName $menu [$w cget -text]]
- if [$w cget -indicatoron] {
+ if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
- incr y [expr -([$menu yposition $entry] \
- + [winfo reqheight $menu])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [winfo reqheight $menu])/2}]
} else {
- incr y [expr -([$menu yposition $entry] \
- + [$menu yposition [expr $entry+1]])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [$menu yposition [expr {$entry+1}]])/2}]
}
}
$menu post $x $y
@@ -305,16 +305,16 @@ proc tkMbPost {w {x {}} {y {}}} {
}
}
right {
- set x [expr [winfo rootx $w] + [winfo width $w]]
- set y [expr (2 * [winfo rooty $w] + [winfo height $w]) / 2]
+ set x [expr {[winfo rootx $w] + [winfo width $w]}]
+ set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [tkMenuFindName $menu [$w cget -text]]
- if [$w cget -indicatoron] {
+ if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
- incr y [expr -([$menu yposition $entry] \
- + [winfo reqheight $menu])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [winfo reqheight $menu])/2}]
} else {
- incr y [expr -([$menu yposition $entry] \
- + [$menu yposition [expr $entry+1]])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [$menu yposition [expr {$entry+1}]])/2}]
}
}
$menu post $x $y
@@ -324,18 +324,18 @@ proc tkMbPost {w {x {}} {y {}}} {
}
}
default {
- if [$w cget -indicatoron] {
+ if {[$w cget -indicatoron]} {
if {$y == ""} {
- set x [expr [winfo rootx $w] + [winfo width $w]/2]
- set y [expr [winfo rooty $w] + [winfo height $w]/2]
+ set x [expr {[winfo rootx $w] + [winfo width $w]/2}]
+ set y [expr {[winfo rooty $w] + [winfo height $w]/2}]
}
tkPostOverPoint $menu $x $y [tkMenuFindName $menu [$w cget -text]]
} else {
- $menu post [winfo rootx $w] [expr [winfo rooty $w]+[winfo height $w]]
+ $menu post [winfo rootx $w] [expr {[winfo rooty $w]+[winfo height $w]}]
}
}
}
- } msg] {
+ } msg]} {
# Error posting menu (e.g. bogus -postcommand). Unpost it and
# reflect the error.
@@ -781,7 +781,7 @@ proc tkMenuNextMenu {menu direction} {
}
set buttons [winfo children [winfo parent $w]]
set length [llength $buttons]
- set i [expr [lsearch -exact $buttons $w] + $count]
+ set i [expr {[lsearch -exact $buttons $w] + $count}]
while 1 {
while {$i < 0} {
incr i $length
@@ -820,13 +820,13 @@ proc tkMenuNextEntry {menu count} {
if {[$menu index last] == "none"} {
return
}
- set length [expr [$menu index last]+1]
+ set length [expr {[$menu index last]+1}]
set quitAfter $length
set active [$menu index active]
if {$active == "none"} {
set i 0
} else {
- set i [expr $active + $count]
+ set i [expr {$active + $count}]
}
while 1 {
if {$quitAfter <= 0} {
@@ -1020,9 +1020,9 @@ proc tkTraverseWithinMenu {w char} {
return
}
for {set i 0} {$i <= $last} {incr i} {
- if [catch {set char2 [string index \
+ if {[catch {set char2 [string index \
[$w entrycget $i -label] \
- [$w entrycget $i -underline]]}] {
+ [$w entrycget $i -underline]]}]} {
continue
}
if {[string compare $char [string tolower $char2]] == 0} {
@@ -1105,7 +1105,7 @@ proc tkMenuFindName {menu s} {
return
}
for {set i 0} {$i <= $last} {incr i} {
- if ![catch {$menu entrycget $i -label} label] {
+ if {![catch {$menu entrycget $i -label} label]} {
if {$label == $s} {
return $i
}
@@ -1131,13 +1131,13 @@ proc tkPostOverPoint {menu x y {entry {}}} {
if {$entry != {}} {
if {$entry == [$menu index last]} {
- incr y [expr -([$menu yposition $entry] \
- + [winfo reqheight $menu])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [winfo reqheight $menu])/2}]
} else {
- incr y [expr -([$menu yposition $entry] \
- + [$menu yposition [expr $entry+1]])/2]
+ incr y [expr {-([$menu yposition $entry] \
+ + [$menu yposition [expr {$entry+1}]])/2}]
}
- incr x [expr -[winfo reqwidth $menu]/2]
+ incr x [expr {-[winfo reqwidth $menu]/2}]
}
$menu post $x $y
if {($entry != {}) && ([$menu entrycget $entry -state] != "disabled")} {
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 07df82b..61fe65f 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -61,7 +61,7 @@ proc tkMessageBox {args} {
}
}
- if ![winfo exists $data(-parent)] {
+ if {![winfo exists $data(-parent)]} {
error "bad window path name \"$data(-parent)\""
}
@@ -111,15 +111,15 @@ proc tkMessageBox {args} {
}
}
- if [string compare $data(-default) ""] {
+ if {[string compare $data(-default) ""]} {
set valid 0
foreach btn $buttons {
- if ![string compare [lindex $btn 0] $data(-default)] {
+ if {![string compare [lindex $btn 0] $data(-default)]} {
set valid 1
break
}
}
- if !$valid {
+ if {!$valid} {
error "invalid default button \"$data(-default)\""
}
}
@@ -127,7 +127,7 @@ proc tkMessageBox {args} {
# 2. Set the dialog to be a child window of $parent
#
#
- if [string compare $data(-parent) .] {
+ if {[string compare $data(-parent) .]} {
set w $data(-parent).__tk__messagebox
} else {
set w .__tk__messagebox
@@ -176,7 +176,7 @@ proc tkMessageBox {args} {
foreach but $buttons {
set name [lindex $but 0]
set opts [lrange $but 1 end]
- if ![string compare $opts {}] {
+ if {![string compare $opts {}]} {
# Capitalize the first letter of $name
set capName \
[string toupper \
@@ -186,7 +186,7 @@ proc tkMessageBox {args} {
eval button $w.$name $opts -command [list "set tkPriv(button) $name"]
- if ![string compare $name $data(-default)] {
+ if {![string compare $name $data(-default)]} {
$w.$name configure -default active
}
pack $w.$name -in $w.bot -side left -expand 1 \
@@ -206,7 +206,7 @@ proc tkMessageBox {args} {
# 6. Create a binding for <Return> on the dialog if there is a
# default button.
- if [string compare $data(-default) ""] {
+ if {[string compare $data(-default) ""]} {
bind $w <Return> "tkButtonInvoke $w.$data(-default)"
}
@@ -216,10 +216,10 @@ proc tkMessageBox {args} {
wm withdraw $w
update idletasks
- set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
- - [winfo vrootx [winfo parent $w]]]
- set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
- - [winfo vrooty [winfo parent $w]]]
+ set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
+ - [winfo vrootx [winfo parent $w]]}]
+ set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
+ - [winfo vrooty [winfo parent $w]]}]
wm geom $w +$x+$y
wm deiconify $w
@@ -231,7 +231,7 @@ proc tkMessageBox {args} {
set grabStatus [grab status $oldGrab]
}
grab $w
- if [string compare $data(-default) ""] {
+ if {[string compare $data(-default) ""]} {
focus $w.$data(-default)
} else {
focus $w
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 32ca096c..bf9768c 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -30,7 +30,7 @@
proc tk_optionMenu {w varName firstValue args} {
upvar #0 $varName var
- if ![info exists var] {
+ if {![info exists var]} {
set var $firstValue
}
menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \
diff --git a/library/palette.tcl b/library/palette.tcl
index 5d5318e..227a241 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -34,41 +34,41 @@ proc tk_setPalette {args} {
} else {
array set new $args
}
- if ![info exists new(background)] {
+ if {![info exists new(background)]} {
error "must specify a background color"
}
- if ![info exists new(foreground)] {
+ if {![info exists new(foreground)]} {
set new(foreground) black
}
set bg [winfo rgb . $new(background)]
set fg [winfo rgb . $new(foreground)]
- set darkerBg [format #%02x%02x%02x [expr (9*[lindex $bg 0])/2560] \
- [expr (9*[lindex $bg 1])/2560] [expr (9*[lindex $bg 2])/2560]]
+ set darkerBg [format #%02x%02x%02x [expr {(9*[lindex $bg 0])/2560}] \
+ [expr {(9*[lindex $bg 1])/2560}] [expr {(9*[lindex $bg 2])/2560}]]
foreach i {activeForeground insertBackground selectForeground \
highlightColor} {
- if ![info exists new($i)] {
+ if {![info exists new($i)]} {
set new($i) $new(foreground)
}
}
- if ![info exists new(disabledForeground)] {
+ if {![info exists new(disabledForeground)]} {
set new(disabledForeground) [format #%02x%02x%02x \
- [expr (3*[lindex $bg 0] + [lindex $fg 0])/1024] \
- [expr (3*[lindex $bg 1] + [lindex $fg 1])/1024] \
- [expr (3*[lindex $bg 2] + [lindex $fg 2])/1024]]
+ [expr {(3*[lindex $bg 0] + [lindex $fg 0])/1024}] \
+ [expr {(3*[lindex $bg 1] + [lindex $fg 1])/1024}] \
+ [expr {(3*[lindex $bg 2] + [lindex $fg 2])/1024}]]
}
- if ![info exists new(highlightBackground)] {
+ if {![info exists new(highlightBackground)]} {
set new(highlightBackground) $new(background)
}
- if ![info exists new(activeBackground)] {
+ if {![info exists new(activeBackground)]} {
# Pick a default active background that islighter than the
# normal background. To do this, round each color component
# up by 15% or 1/3 of the way to full white, whichever is
# greater.
foreach i {0 1 2} {
- set light($i) [expr [lindex $bg $i]/256]
- set inc1 [expr ($light($i)*15)/100]
- set inc2 [expr (255-$light($i))/3]
+ set light($i) [expr {[lindex $bg $i]/256}]
+ set inc1 [expr {($light($i)*15)/100}]
+ set inc2 [expr {(255-$light($i))/3}]
if {$inc1 > $inc2} {
incr light($i) $inc1
} else {
@@ -81,13 +81,13 @@ proc tk_setPalette {args} {
set new(activeBackground) [format #%02x%02x%02x $light(0) \
$light(1) $light(2)]
}
- if ![info exists new(selectBackground)] {
+ if {![info exists new(selectBackground)]} {
set new(selectBackground) $darkerBg
}
- if ![info exists new(troughColor)] {
+ if {![info exists new(troughColor)]} {
set new(troughColor) $darkerBg
}
- if ![info exists new(selectColor)] {
+ if {![info exists new(selectColor)]} {
set new(selectColor) #b03060
}
@@ -188,18 +188,18 @@ proc tkRecolorTree {w colors} {
proc tkDarken {color percent} {
set l [winfo rgb . $color]
- set red [expr [lindex $l 0]/256]
- set green [expr [lindex $l 1]/256]
- set blue [expr [lindex $l 2]/256]
- set red [expr ($red*$percent)/100]
+ set red [expr {[lindex $l 0]/256}]
+ set green [expr {[lindex $l 1]/256}]
+ set blue [expr {[lindex $l 2]/256}]
+ set red [expr {($red*$percent)/100}]
if {$red > 255} {
set red 255
}
- set green [expr ($green*$percent)/100]
+ set green [expr {($green*$percent)/100}]
if {$green > 255} {
set green 255
}
- set blue [expr ($blue*$percent)/100]
+ set blue [expr {($blue*$percent)/100}]
if {$blue > 255} {
set blue 255
}
diff --git a/library/safetk.tcl b/library/safetk.tcl