#!/usr/bin/wish8.4 # # This file is Mohave.v3.tcl, or Version 3 of the Mohave-mahjongg GUI. # This file is dated Jan.06.2008 # This update of Mohave.v2.tcl uses drop down menus, # rather than for selecting tiles and backgrounds. # This change was made because the number of tilesets is getting too large # for buttons. # # This version of the Mohave x-mahjongg launcher is # designed to take up less screen space than the original Mohave GUI. # # 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 #d6dedc font create magicfont -family Bitstream -size 11 -weight normal . configure -padx 0 -pady 0 foreach class { Button Checkbutton Entry Label Listbox Menu Menubutton \ Message Radiobutton Scale tk_messagebox MessageBox Text Dialog.msg } { \ option add *$class.font magicfont widgetDefault } # set frcolor #d6dedc set textcolor #000000 set buttoncolor #4c688a set buttforecolor #d8d8d8 set pagecolor "rgb(200,205,195)" set buttonwidth 6 set buttonheight 6 set laybutts 8 set padding 2 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 # create a menu bar frame .menubar \ -padx 2 -pady 2\ -relief groove \ -borderwidth 3 \ -background $buttoncolor # frame .midframe \ -padx $framepad -pady $framepad\ -borderwidth 0 \ -background $frcolor \ -width 410 \ -height 300px frame .bottomframe \ -padx $framepad -pady $framepad\ -borderwidth 2 \ -relief groove \ -background $frcolor \ -width 410 # # ----------create images ----------- # need to create images before they can appear for {set jkl 1} {$jkl < 58} {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 } # create tiles menu menubutton .menubar.tiles1 -text "tilesets1" -menu .menubar.tiles1.menu\ -background $buttoncolor\ -foreground $buttforecolor \ -relief flat\ -borderwidth 0 \ -padx $padding -pady $padding \ -font magicfont menu .menubar.tiles1.menu # .menubar.tiles1.menu add command -label "tileset1"\ -font magicfont \ -command { .midframe.settiles configure -image tileset1.gif; set tileset mohaveset1; } # .menubar.tiles1.menu add command -label "Balloons"\ -font magicfont \ -command { .midframe.settiles configure -image tileset2.gif; set tileset mohaveset2; } # .menubar.tiles1.menu add command -label "tileset3"\ -font magicfont \ -command { .midframe.settiles configure -image tileset3.gif; set tileset mohaveset3; } # .menubar.tiles1.menu add command -label "tileset4"\ -font magicfont \ -command { .midframe.settiles configure -image tileset4.gif; set tileset mohaveset4; } # .menubar.tiles1.menu add command -label "tileset5"\ -font magicfont \ -command { .midframe.settiles configure -image tileset5.gif; set tileset mohaveset5; } # .menubar.tiles1.menu add command -label "Butterflies"\ -font magicfont \ -command { .midframe.settiles configure -image tileset6.gif; set tileset mohaveset6; } # .menubar.tiles1.menu add command -label "tileset7"\ -font magicfont \ -command { .midframe.settiles configure -image tileset7.gif; set tileset mohaveset7; } # .menubar.tiles1.menu add command -label "tileset8"\ -font magicfont \ -command { .midframe.settiles configure -image tileset8.gif; set tileset mohaveset8; } # .menubar.tiles1.menu add command -label "Cards"\ -font magicfont \ -command { .midframe.settiles configure -image tileset9.gif; set tileset mohaveset9; } # .menubar.tiles1.menu add command -label "tileset10"\ -font magicfont \ -command { .midframe.settiles configure -image tileset10.gif; set tileset mohaveset10; } # .menubar.tiles1.menu add command -label "Chessmen"\ -font magicfont \ -command { .midframe.settiles configure -image tileset11.gif; set tileset mohaveset11; } # .menubar.tiles1.menu add command -label "tileset12"\ -font magicfont \ -command { .midframe.settiles configure -image tileset12.gif; set tileset mohaveset12; } # .menubar.tiles1.menu add command -label "tileset13"\ -font magicfont \ -command { .midframe.settiles configure -image tileset13.gif; set tileset mohaveset13; } # .menubar.tiles1.menu add command -label "Scotch"\ -font magicfont \ -command { .midframe.settiles configure -image tileset14.gif; set tileset mohaveset14; } # .menubar.tiles1.menu add command -label "tileset15"\ -font magicfont \ -command { .midframe.settiles configure -image tileset15.gif; set tileset mohaveset15; } # .menubar.tiles1.menu add command -label "CropCircles"\ -font magicfont \ -command { .midframe.settiles configure -image tileset16.gif; set tileset mohaveset16; } # .menubar.tiles1.menu add command -label "Disney"\ -font magicfont \ -command { .midframe.settiles configure -image tileset17.gif; set tileset mohaveset17; } # .menubar.tiles1.menu add command -label "Dogs"\ -font magicfont \ -command { .midframe.settiles configure -image tileset18.gif; set tileset mohaveset18; } # .menubar.tiles1.menu add command -label "Dominoes"\ -font magicfont \ -command { .midframe.settiles configure -image tileset19.gif; set tileset mohaveset19; } # .menubar.tiles1.menu add command -label "Dragons"\ -font magicfont \ -command { .midframe.settiles configure -image tileset20.gif; set tileset mohaveset20; } # ............................................. menubutton .menubar.tiles2 -text "tilesets2" -menu .menubar.tiles2.menu\ -background $buttoncolor\ -foreground $buttforecolor \ -relief flat\ -borderwidth 0 \ -font magicfont menu .menubar.tiles2.menu # .menubar.tiles2.menu add command -label "Native"\ -font magicfont \ -command { .midframe.settiles configure -image tileset21.gif; set tileset mohaveset21; } # .menubar.tiles2.menu add command -label "tileset22"\ -font magicfont \ -command { .midframe.settiles configure -image tileset22.gif; set tileset mohaveset22; } # .menubar.tiles2.menu add command -label "Fans"\ -font magicfont \ -command { .midframe.settiles configure -image tileset23.gif; set tileset mohaveset23; } # .menubar.tiles2.menu add command -label "ArtWorks"\ -font magicfont \ -command { .midframe.settiles configure -image tileset24.gif; set tileset mohaveset24; } # .menubar.tiles2.menu add command -label "Gargolyes"\ -font magicfont \ -command { .midframe.settiles configure -image tileset25.gif; set tileset mohaveset25; } # .menubar.tiles2.menu add command -label "tileset26"\ -font magicfont \ -command { .midframe.settiles configure -image tileset26.gif; set tileset mohaveset26; } # .menubar.tiles2.menu add command -label "Fractals"\ -font magicfont \ -command { .midframe.settiles configure -image tileset27.gif; set tileset mohaveset27; } # .menubar.tiles2.menu add command -label "Japan"\ -font magicfont \ -command { .midframe.settiles configure -image tileset28.gif; set tileset mohaveset28; } # .menubar.tiles2.menu add command -label "AnimeGirls"\ -font magicfont \ -command { .midframe.settiles configure -image tileset29.gif; set tileset mohaveset29; } # .menubar.tiles2.menu add command -label "tileset30"\ -font magicfont \ -command { .midframe.settiles configure -image tileset30.gif; set tileset mohaveset30; } # .menubar.tiles2.menu add command -label "Jewels"\ -font magicfont \ -command { .midframe.settiles configure -image tileset31.gif; set tileset mohaveset31; } # .menubar.tiles2.menu add command -label "tileset32"\ -font magicfont \ -command { .midframe.settiles configure -image tileset32.gif; set tileset mohaveset32; } # .menubar.tiles2.menu add command -label "tileset33"\ -font magicfont \ -command { .midframe.settiles configure -image tileset33.gif; set tileset mohaveset33; } # .menubar.tiles2.menu add command -label "tileset34"\ -font magicfont \ -command { .midframe.settiles configure -image tileset34.gif; set tileset mohaveset34; } # .menubar.tiles2.menu add command -label "tileset35"\ -font magicfont \ -command { .midframe.settiles configure -image tileset35.gif; set tileset mohaveset35; } # .menubar.tiles2.menu add command -label "tileset36"\ -font magicfont \ -command { .midframe.settiles configure -image tileset36.gif; set tileset mohaveset36; } # .menubar.tiles2.menu add command -label "Fractals2"\ -font magicfont \ -command { .midframe.settiles configure -image tileset37.gif; set tileset mohaveset37; } # .menubar.tiles2.menu add command -label "Picasso"\ -font magicfont \ -command { .midframe.settiles configure -image tileset38.gif; set tileset mohaveset38; } # .menubar.tiles2.menu add command -label "Pinups1"\ -font magicfont \ -command { .midframe.settiles configure -image tileset39.gif; set tileset mohaveset39; } # .menubar.tiles2.menu add command -label "Pinups2"\ -font magicfont \ -command { .midframe.settiles configure -image tileset40.gif; set tileset mohaveset40; } # ............................................. menubutton .menubar.tiles3 -text "tilesets3" -menu .menubar.tiles3.menu\ -background $buttoncolor\ -foreground $buttforecolor \ -relief flat\ -borderwidth 0 \ -font magicfont menu .menubar.tiles3.menu # .menubar.tiles3.menu add command -label "Playboy"\ -font magicfont \ -command { .midframe.settiles configure -image tileset41.gif; set tileset mohaveset41; } # .menubar.tiles3.menu add command -label "tileset42"\ -font magicfont \ -command { .midframe.settiles configure -image tileset42.gif; set tileset mohaveset42; } # .menubar.tiles3.menu add command -label "tileset43"\ -font magicfont \ -command { .midframe.settiles configure -image tileset43.gif; set tileset mohaveset43; } # .menubar.tiles3.menu add command -label "RealTiles"\ -font magicfont \ -command { .midframe.settiles configure -image tileset44.gif; set tileset mohaveset44; } # .menubar.tiles3.menu add command -label "tileset45"\ -font magicfont \ -command { .midframe.settiles configure -image tileset45.gif; set tileset mohaveset45; } # .menubar.tiles3.menu add command -label "tileset46"\ -font magicfont \ -command { .midframe.settiles configure -image tileset46.gif; set tileset mohaveset46; } # .menubar.tiles3.menu add command -label "Knights"\ -font magicfont \ -command { .midframe.settiles configure -image tileset47.gif; set tileset mohaveset47; } # .menubar.tiles3.menu add command -label "tileset48"\ -font magicfont \ -command { .midframe.settiles configure -image tileset48.gif; set tileset mohaveset48; } # .menubar.tiles3.menu add command -label "tileset49"\ -font magicfont \ -command { .midframe.settiles configure -image tileset49.gif; set tileset mohaveset49; } # .menubar.tiles3.menu add command -label "tileset50"\ -font magicfont \ -command { .midframe.settiles configure -image tileset50.gif; set tileset mohaveset50; } # .menubar.tiles3.menu add command -label "Textures1"\ -font magicfont \ -command { .midframe.settiles configure -image tileset51.gif; set tileset mohaveset51; } # .menubar.tiles3.menu add command -label "Stones"\ -font magicfont \ -command { .midframe.settiles configure -image tileset52.gif; set tileset mohaveset52; } # .menubar.tiles3.menu add command -label "tileset53"\ -font magicfont \ -command { .midframe.settiles configure -image tileset53.gif; set tileset mohaveset53; } # .menubar.tiles3.menu add command -label "tileset54"\ -font magicfont \ -command { .midframe.settiles configure -image tileset54.gif; set tileset mohaveset54; } # .menubar.tiles3.menu add command -label "Vases"\ -font magicfont \ -command { .midframe.settiles configure -image tileset55.gif; set tileset mohaveset55; } # .menubar.tiles3.menu add command -label "tileset56"\ -font magicfont \ -command { .midframe.settiles configure -image tileset56.gif; set tileset mohaveset56; } # .menubar.tiles3.menu add command -label "tileset57"\ -font magicfont \ -command { .midframe.settiles configure -image tileset57.gif; set tileset mohaveset57; } # # ............................................. # create background menu menubutton .menubar.bkground1 -text "bkgrnds1" -menu .menubar.bkground1.menu\ -background $buttoncolor\ -foreground $buttforecolor \ -relief flat\ -borderwidth 0 \ -font magicfont menu .menubar.bkground1.menu # .menubar.bkground1.menu add command -label "bkgrd1"\ -font magicfont \ -command { .midframe.bg1 configure -image back1.gif; .midframe.bg2 configure -image back1.gif; set bakk bkgrd1; } .menubar.bkground1.menu add command -label "bkgrd2"\ -font magicfont \ -command { .midframe.bg1 configure -image back2.gif; .midframe.bg2 configure -image back2.gif; set bakk bkgrd2; } .menubar.bkground1.menu add command -label "bkgrd3"\ -font magicfont \ -command { .midframe.bg1 configure -image back3.gif; .midframe.bg2 configure -image back3.gif; set bakk bkgrd3; } .menubar.bkground1.menu add command -label "bkgrd4"\ -font magicfont \ -command { .midframe.bg1 configure -image back4.gif; .midframe.bg2 configure -image back4.gif; set bakk bkgrd4; } .menubar.bkground1.menu add command -label "bkgrd5"\ -font magicfont \ -command { .midframe.bg1 configure -image back5.gif; .midframe.bg2 configure -image back5.gif; set bakk bkgrd5; } .menubar.bkground1.menu add command -label "bkgrd6"\ -font magicfont \ -command { .midframe.bg1 configure -image back6.gif; .midframe.bg2 configure -image back6.gif; set bakk bkgrd6; } .menubar.bkground1.menu add command -label "bkgrd7"\ -font magicfont \ -command { .midframe.bg1 configure -image back7.gif; .midframe.bg2 configure -image back7.gif; set bakk bkgrd7; } .menubar.bkground1.menu add command -label "bkgrd8"\ -font magicfont \ -command { .midframe.bg1 configure -image back8.gif; .midframe.bg2 configure -image back8.gif; set bakk bkgrd8; } .menubar.bkground1.menu add command -label "bkgrd9"\ -font magicfont \ -command { .midframe.bg1 configure -image back9.gif; .midframe.bg2 configure -image back9.gif; set bakk bkgrd9; } .menubar.bkground1.menu add command -label "TomJerry"\ -font magicfont \ -command { .midframe.bg1 configure -image back10.gif; .midframe.bg2 configure -image back10.gif; set bakk bkgrd10; } .menubar.bkground1.menu add command -label "Marble"\ -font magicfont \ -command { .midframe.bg1 configure -image back11.gif; .midframe.bg2 configure -image back11.gif; set bakk bkgrd11; } .menubar.bkground1.menu add command -label "bkgrd12"\ -font magicfont \ -command { .midframe.bg1 configure -image back12.gif; .midframe.bg2 configure -image back12.gif; set bakk bkgrd12; } .menubar.bkground1.menu add command -label "bkgrd13"\ -font magicfont \ -command { .midframe.bg1 configure -image back13.gif; .midframe.bg2 configure -image back13.gif; set bakk bkgrd13; } .menubar.bkground1.menu add command -label "bkgrd14"\ -font magicfont \ -command { .midframe.bg1 configure -image back14.gif; .midframe.bg2 configure -image back14.gif; set bakk bkgrd14; } .menubar.bkground1.menu add command -label "Lightwood"\ -font magicfont \ -command { .midframe.bg1 configure -image back15.gif; .midframe.bg2 configure -image back15.gif; set bakk bkgrd15; } .menubar.bkground1.menu add command -label "Darkwood"\ -font magicfont \ -command { .midframe.bg1 configure -image back16.gif; .midframe.bg2 configure -image back16.gif; set bakk bkgrd16; } .menubar.bkground1.menu add command -label "Tux"\ -font magicfont \ -command { .midframe.bg1 configure -image back17.gif; .midframe.bg2 configure -image back17.gif; set bakk bkgrd17; } .menubar.bkground1.menu add command -label "Carpet1"\ -font magicfont \ -command { .midframe.bg1 configure -image back18.gif; .midframe.bg2 configure -image back18.gif; set bakk bkgrd18; } .menubar.bkground1.menu add command -label "Carpet2"\ -font magicfont \ -command { .midframe.bg1 configure -image back19.gif; .midframe.bg2 configure -image back19.gif; set bakk bkgrd19; } .menubar.bkground1.menu add command -label "Curtain1"\ -font magicfont \ -command { .midframe.bg1 configure -image back20.gif; .midframe.bg2 configure -image back20.gif; set bakk bkgrd20; } .menubar.bkground1.menu add command -label "BlueGrad"\ -font magicfont \ -command { .midframe.bg1 configure -image back21.gif; .midframe.bg2 configure -image back21.gif; set bakk bkgrd21; } .menubar.bkground1.menu add command -label "BlueMist"\ -font magicfont \ -command { .midframe.bg1 configure -image back22.gif; .midframe.bg2 configure -image back22.gif; set bakk bkgrd22; } # ............................................... # create layout menu menubutton .menubar.layouts -text "layouts" -menu .menubar.layouts.menu\ -background $buttoncolor\ -foreground $buttforecolor \ -relief flat\ -borderwidth 0 \ -font magicfont menu .menubar.layouts.menu # .menubar.layouts.menu add command -label "Arena"\ -font magicfont \ -command {set scheme "arena";} .menubar.layouts.menu add command -label "Boar"\ -font magicfont \ -command {set scheme "boar";} .menubar.layouts.menu add command -label "Ceremonial"\ -font magicfont \ -command {set scheme "ceremonial";} .menubar.layouts.menu add command -label "Dragon"\ -font magicfont \ -command {set scheme "dragon";} .menubar.layouts.menu add command -label "Hare"\ -font magicfont \ -command {set scheme "hare";} .menubar.layouts.menu add command -label "Arrow"\ -font magicfont \ -command {set scheme "arrow";} .menubar.layouts.menu add command -label "Bridge"\ -font magicfont \ -command {set scheme "bridge";} .menubar.layouts.menu add command -label "Farandole"\ -font magicfont \ -command {set scheme "farandole";} .menubar.layouts.menu add command -label "Horse"\ -font magicfont \ -command {set scheme "horse";} .menubar.layouts.menu add command -label "Monkey"\ -font magicfont \ -command {set scheme "monkey";} .menubar.layouts.menu add command -label "Hourglass"\ -font magicfont \ -command {set scheme "hourglass";} .menubar.layouts.menu add command -label "Ox"\ -font magicfont \ -command {set scheme "ox";} .menubar.layouts.menu add command -label "Ram"\ -font magicfont \ -command {set scheme "ram";} .menubar.layouts.menu add command -label "Rooster"\ -font magicfont \ -command {set scheme "snake";} .menubar.layouts.menu add command -label "Snake"\ -font magicfont \ -command {set scheme "snake";} .menubar.layouts.menu add command -label "DeepWell"\ -font magicfont \ -command {set scheme "deepwell";} .menubar.layouts.menu add command -label "Dog"\ -font magicfont \ -command {set scheme "dog";} .menubar.layouts.menu add command -label "Papillon"\ -font magicfont \ -command {set scheme "papillon";} .menubar.layouts.menu add command -label "Scoon"\ -font magicfont \ -command {set scheme "schoon";} .menubar.layouts.menu add command -label "Theater"\ -font magicfont \ -command {set scheme "theater";} # ----------create buttons -------------------- button .bottomframe.play \ -background $buttoncolor \ -foreground $buttforecolor \ -font magicfont \ -width $buttonwidth \ -text "play x-mahjongg" \ -padx $padding -pady $padding \ -command { global tileset; exec xmahjongg --bg $bakk --tileset $tileset --layout $scheme & } # button .bottomframe.exitb \ -background $buttoncolor \ -foreground $buttforecolor \ -font magicfont \ -relief groove\ -width $buttonwidth \ -text "exit mohave" \ -padx $padding -pady $padding \ -command {set exitanswer [tk_messageBox -icon question -message "are you sure?" \ -parent . \ -title "Exit?" -type yesno]; if {$exitanswer ==yes} then { clipboard clear; exit} } # ......................................... label .midframe.settiles \ -background black \ -foreground black \ -font magicfont \ -image tileset1.gif \ -relief groove \ -borderwidth 0 \ -padx $padding -pady $padding label .midframe.bg1 \ -background black \ -foreground black \ -relief groove \ -font magicfont \ -padx $padding -pady $padding \ -borderwidth 0 \ -width 50\ -height 280 \ -image back1.gif label .midframe.bg2 \ -background black \ -foreground black \ -relief groove \ -font magicfont \ -padx $padding -pady $padding \ -borderwidth 0 \ -width 50\ -height 280 \ -image back1.gif #------------------------------------ pack .menubar.tiles1 .menubar.tiles2 .menubar.tiles3 .menubar.bkground1 .menubar.layouts -side left -expand 1 -fill x # pack .midframe.bg1 .midframe.settiles .midframe.bg2 -expand 1 -fill y -side left -anchor n # pack .bottomframe.play .bottomframe.exitb -expand 1 -fill x -side left -anchor w # pack .menubar .midframe .bottomframe -expand 1 -fill x -anchor w