1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-14 23:46:10 +00:00
freebsd-ports/games/tksol/files/patch-b

164 lines
6.2 KiB
Plaintext
Raw Normal View History

--- release/tksol.in.orig Mon Feb 14 22:39:16 1994
+++ release/tksol.in Wed Aug 12 14:19:13 1998
@@ -22,7 +22,9 @@
global argv tksol
- set tksol(colormodel) [tk colormodel .]
+ option add *highlightThickness 0
+
+ set tksol(colormodel) [winfo depth .]
set tksol(version) 1.0; # don't change this!
set tksol(debug) 0
@@ -70,7 +72,7 @@
set tksol(bottom_level) 150; # position of bottom level stacks
set tksol(button.font) 9x15
- if {$tksol(colormodel) == "color"} {
+ if {$tksol(colormodel) > 1} {
set tksol(button.foreground) White
set tksol(button.background) DeepSkyBlue1
set tksol(button.activeForeground) Black
@@ -154,7 +156,7 @@
##########################################################
proc SetupTable {} {
- global ItemToCard Score tksol
+ global ItemToCard Score tksol argv0 argv
set canvas_width [expr (7 * $tksol(card.width)) + \
(2 * $tksol(side_margin)) + \
@@ -165,7 +167,7 @@
set tksol(canvas.height) $canvas_height
# create the canvas
- if {$tksol(colormodel) == "color"} {
+ if {$tksol(colormodel) > 1} {
canvas .canvas -width $canvas_width -height $canvas_height \
-background $tksol(canvas.background) -relief raise
} else {
@@ -192,7 +194,7 @@
# create the dividing line
set midpt [expr ($tksol(top_level) + $tksol(bottom_level) + \
$tksol(card.height)) / 2]
- if {$tksol(colormodel) == "color"} {
+ if {$tksol(colormodel) > 1} {
.canvas create line 0 $midpt $canvas_width $midpt -fill black
} else {
.canvas create line 0 $midpt $canvas_width $midpt -fill white
@@ -223,7 +225,7 @@
# create the bottom level placeholders, which are invisible
set x $tksol(side_margin)
- if {$tksol(colormodel) == "color"} {
+ if {$tksol(colormodel) > 1} {
set placeholder_color "-fill $tksol(canvas.background)"
} else {
set placeholder_color "-fill black -stipple gray50"
@@ -241,6 +243,8 @@
wm sizefrom . user
wm iconname . "TkSol"
wm title . "TkSolitaire $tksol(version)"
+ wm command . [concat $argv0 $argv]
+ wm group . .
# now create a few buttons
frame .button -background $tksol(canvas.background) -relief raise -bd 2
@@ -632,7 +636,8 @@
pack .b.outline -side top -fill x -padx 2 -pady 2
label .b.outline.label -width $label_width -anchor e -text "Drag Outline:"
foreach toggle {yes no} {
- radiobutton .b.outline.$toggle -text $toggle -variable tksol(outline)
+ radiobutton .b.outline.$toggle -text $toggle \
+ -variable tksol(outline) -value $toggle
}
.b.outline.$tksol(outline) select
pack .b.outline.label -side left -padx 2 -pady 2
@@ -701,7 +706,7 @@
# finally setup the bitmap canvas
canvas .b.bitmap.canvas -background $tksol(canvas.background)
- scrollbar .b.bitmap.scroll -background $tksol(canvas.background) \
+ scrollbar .b.bitmap.scroll -troughcolor $tksol(canvas.background) \
-command ".b.bitmap.canvas yview" -relief sunken
pack .b.bitmap.scroll -side right -fill y -padx 2 -pady 2
pack .b.bitmap.canvas -fill both -padx 2 -pady 2
@@ -712,7 +717,7 @@
.b.entry.bitmap.e insert 0 "$bitmap";
}
- .b.bitmap.canvas bind bitmap_Tag <Any-Double-ButtonPress-1> {
+ .b.bitmap.canvas bind bitmap_Tag <Double-ButtonPress-1> {
set bitmap [file tail [lindex [.b.bitmap.canvas gettags current] 1]]; \
.b.entry.bitmap.e delete 0 end; \
.b.entry.bitmap.e insert 0 "$bitmap"; \
@@ -762,7 +767,7 @@
.b.bitmap.canvas configure -height $canvas_height \
-background $tksol(canvas.background) \
-scrollregion [list 0 0 $canvas_width $scroll_height] \
- -yscroll ".b.bitmap.scroll set" -relief sunken
+ -yscrollcommand ".b.bitmap.scroll set" -relief sunken
set x_offset [expr int($margin + ($spacing / 2))]
set y_offset $x_offset
@@ -1019,13 +1024,13 @@
set xdistance [expr [lindex $endstk 0] - [lindex $beginstk 0]]
# note that we divide by 12, not 13, since the last card is positioned
# on the coordinates of the last playstack, ie. playspot6
- set x_offset [expr $xdistance / 12]
+ set x_offset [expr round([expr $xdistance / 12])]
set ydistance [expr $tksol(canvas.height) - [lindex $beginstk 1] - \
$tksol(card.height)]
# we divide by 3 here since the bottom stack must be fully visible ...
set y_offset [expr $ydistance / 3]
- set x [lindex $beginstk 0]
- set y [lindex $beginstk 1]
+ set x [expr round([lindex $beginstk 0])]
+ set y [expr round([lindex $beginstk 1])]
for {set endstk_no 0} {$endstk_no < 4} {incr endstk_no} {
# layout each suit on the canvas
.canvas raise endstk${endstk_no}_Tag all
@@ -1040,7 +1045,7 @@
update idletasks
incr x $x_offset
}
- set x [lindex $beginstk 0]
+ set x [expr round([lindex $beginstk 0])]
incr y [expr round(floor($y_offset))]
}
@@ -1950,25 +1955,25 @@
global tksol
# single click on drawleft stack flip the card over to drawright
- .canvas bind drawleft_Tag <Any-ButtonPress-1> "MoveRightMany"
+ .canvas bind drawleft_Tag <ButtonPress-1> {MoveRightMany; break}
# single click on flip move all the cards from drawright over
- .canvas bind flip_Tag <Any-ButtonPress-1> "MoveLeft"
+ .canvas bind flip_Tag <ButtonPress-1> "MoveLeft"
# single click on a facedown card on top of a stack flip it
- .canvas bind down_Tag <Any-ButtonPress-1> "FlipUp"
+ .canvas bind down_Tag <ButtonPress-1> "FlipUp"
# press of button-1 on a faceup card setup the current working stack
- .canvas bind up_Tag <Any-ButtonPress-1> "SetupWorkStack %x %y"
+ .canvas bind up_Tag <ButtonPress-1> "SetupWorkStack %x %y"
# motion drags the current working stack around
- .canvas bind up_Tag <Any-B1-Motion> "DragWorkStack %x %y"
+ .canvas bind up_Tag <B1-Motion> "DragWorkStack %x %y"
# release of button-1 moves the working stack to a new location (maybe)
- .canvas bind up_Tag <Any-ButtonRelease-1> "ProcessWorkStack %x %y"
+ .canvas bind up_Tag <ButtonRelease-1> "ProcessWorkStack %x %y"
# double click on an up card attempts to move it to the end stack
- .canvas bind up_Tag <Any-Double-ButtonPress-1> "ClearWorkStack %x %y"
+ .canvas bind up_Tag <Double-ButtonPress-1> "ClearWorkStack %x %y"
}