#!/usr/bin/wish8.4 # # This file is dated Feb.24.2007 # # Mohave is a GUI front end for x-mahjongg. # Mohave was written by legendary mahjongg afficionado # and man-about-town, Dave Leo, # in January 2007 and first posted at # [http://www.tikmark.com/Mohave/mohave.html] on Feb.06.2007 # Federal law prohibits use of this product. # Ask your doctor if x-mahjongg is right for you. # #COPYRIGHT/LICENSE #All source code is Copyright (C) 2007 by Dave Leo. #This package is distributed under the GNU General Public License, Version #2, or, at your discretion, any later version. The GNU General Public License #is available via the Web at . The GPL #is designed to allow you to alter and redistribute the package, as long as #you do not remove that freedom from others. # # # # window configure . configure -background #b3c0b3 font create davesfont -family Courier -size 10 -weight normal . configure -padx 0 -pady 0 # set frcolor #b3c0b3 set textcolor #000000 set buttoncolor #c0c0c0 set buttforecolor #000000 set pagecolor "rgb(200,205,195)" set buttonwidth 6 set buttonheight 6 set laybutts 8 set padding 1 set framepad 0 set nexxtt 1 set nexxttbg 1 set tileset "mohaveset1" set bakk "bkgrd1" set scheme "dragon" # --------------------------------------------------------------------------------------------------- # redefine these directories as necessary for the version of xmahjongg # on your computer set tiledir "/usr/share/games/xmahjongg/tiles" set bkgrddir "/usr/share/games/xmahjongg/backgrounds" set layoutdir "/usr/share/games/xmahjongg/layouts" # # ----------------------------------------------------- frame .topframe \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -relief groove \ -background $frcolor \ -width 410 # frame .midframe \ -padx $framepad -pady $framepad\ -borderwidth 0 \ -background $frcolor \ -width 451 frame .midframe2 \ -padx $framepad -pady $framepad\ -borderwidth 0 \ -background $frcolor \ -width 410 # # frame .bottomframe \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -relief groove \ -background $frcolor \ -width 410 frame .bottomframe2 \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -relief groove \ -background $frcolor \ -width 410 frame .bottomframe3 \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -relief groove \ -background $frcolor \ -width 410 frame .bottomframe4 \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -background $frcolor \ -width 410 frame .bottomframe5 \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -background $frcolor \ -width 410 # # -----------------------------------file menu items #menubutton .topframe.file -text "File" -menu .topframe.file.menu\ # -background #c0c0c0\ # -relief groove \ # -font davesfont #menu .topframe.file.menu # #.topframe.file.menu add command -label "Play"\ # -font davesfont \ # -command { global tileset; # exec xmahjongg --bg $bakk --tileset $tileset & # } # #.topframe.file.menu add command -label "Exit"\ # -font davesfont \ # -command { # set exitanswer [tk_messageBox -icon question -message "are you sure?" \ # -parent . \ # -title "Exit?" -type yesno]; # if {$exitanswer ==yes} then { clipboard clear; # exit} # } # # -----------------------------create images for buttons ------------------------------- # need to create images before they can appear in buttons for {set jkl 1} {$jkl < 32} {incr jkl} { image create photo tileset$jkl.gif -file $tiledir/mohaveset$jkl.gif } # for {set abc 1} {$abc < 23} {incr abc} { image create photo back$abc.gif -file $bkgrddir/bkgrd$abc.gif } # image create photo arena.gif -file $layoutdir/arena.gif image create photo boar.gif -file $layoutdir/boar.gif image create photo ceremo.gif -file $layoutdir/ceremo.gif image create photo dragon.gif -file $layoutdir/dragon.gif image create photo hare.gif -file $layoutdir/hare.gif image create photo hrglass.gif -file $layoutdir/hrglass.gif image create photo ox.gif -file $layoutdir/ox.gif image create photo ram.gif -file $layoutdir/ram.gif image create photo rooster.gif -file $layoutdir/rooster.gif image create photo snake.gif -file $layoutdir/snake.gif # -----------------------------create buttons ------------------------------------------ button .topframe.nextiles \ -background $buttoncolor \ -foreground $buttforecolor \ -font davesfont \ -width $buttonwidth \ -text "tiles>" \ -padx $padding -pady $padding \ -command {global nexxtt; incr nexxtt +1; if {$nexxtt > 31} then {set nexxtt 1}; .midframe.settiles configure -image tileset$nexxtt.gif; set tileset mohaveset$nexxtt; global tileset; } button .topframe.prevtiles \ -background $buttoncolor \ -foreground $buttforecolor \ -font davesfont \ -width $buttonwidth \ -text "" \ -padx $padding -pady $padding \ -command {global nexxttbg; incr nexxttbg +1; if {$nexxttbg > 22} then {set nexxttbg 1}; .midframe.bg1 configure -image back$nexxttbg.gif; .midframe.bg2 configure -image back$nexxttbg.gif; set bakk bkgrd$nexxttbg; global bakk; } button .topframe.prevbg \ -background $buttoncolor \ -foreground $buttforecolor \ -font davesfont \ -width $buttonwidth \ -text "