|
|
1.1 ! root 1: # Window: Budget, for Unix Micropolis ! 2: # ! 3: # Micropolis, Unix Version. This game was released for the Unix platform ! 4: # in or about 1990 and has been modified for inclusion in the One Laptop ! 5: # Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If ! 6: # you need assistance with this program, you may contact: ! 7: # http://wiki.laptop.org/go/Micropolis or email [email protected]. ! 8: # ! 9: # This program is free software: you can redistribute it and/or modify ! 10: # it under the terms of the GNU General Public License as published by ! 11: # the Free Software Foundation, either version 3 of the License, or (at ! 12: # your option) any later version. ! 13: # ! 14: # This program is distributed in the hope that it will be useful, but ! 15: # WITHOUT ANY WARRANTY; without even the implied warranty of ! 16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! 17: # General Public License for more details. You should have received a ! 18: # copy of the GNU General Public License along with this program. If ! 19: # not, see <http://www.gnu.org/licenses/>. ! 20: # ! 21: # ADDITIONAL TERMS per GNU GPL Section 7 ! 22: # ! 23: # No trademark or publicity rights are granted. This license does NOT ! 24: # give you any right, title or interest in the trademark SimCity or any ! 25: # other Electronic Arts trademark. You may not distribute any ! 26: # modification of this program using the trademark SimCity or claim any ! 27: # affliation or association with Electronic Arts Inc. or its employees. ! 28: # ! 29: # Any propagation or conveyance of this program must include this ! 30: # copyright notice and these terms. ! 31: # ! 32: # If you convey this program (or any modifications of it) and assume ! 33: # contractual liability for the program to recipients of it, you agree ! 34: # to indemnify Electronic Arts for any liability that those contractual ! 35: # assumptions impose on Electronic Arts. ! 36: # ! 37: # You may not misrepresent the origins of this program; modified ! 38: # versions of the program must be marked as such and not identified as ! 39: # the original program. ! 40: # ! 41: # This disclaimer supplements the one included in the General Public ! 42: # License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS ! 43: # PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY ! 44: # OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF ! 45: # SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS ! 46: # DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES, ! 47: # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, ! 48: # FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY ! 49: # RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING, ! 50: # USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST ! 51: # INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL ! 52: # MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE ! 53: # UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE ! 54: # WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE ! 55: # CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR ! 56: # ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME ! 57: # JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED ! 58: # WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A ! 59: # CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY ! 60: # NOT APPLY TO YOU. ! 61: global BudgetWindows ! 62: set n [Unique] ! 63: set win .budget$n ! 64: set BudgetWindows [linsert $BudgetWindows 0 $win] ! 65: ! 66: LinkWindow $head.budget $win ! 67: LinkWindow $win.head $head ! 68: ! 69: catch "destroy $win" ! 70: toplevel $win -screen $display ! 71: ! 72: SetHelp $win Budget ! 73: ! 74: global [set var $win.visible] ! 75: set $var 0 ! 76: ! 77: wm title $win {Micropolis Budget} ! 78: wm iconname $win {Micropolis Budget} ! 79: wm group $win $head ! 80: wm geometry $win 600x600+5+5 ! 81: wm positionfrom $win user ! 82: wm maxsize $win 700 700 ! 83: wm minsize $win 150 200 ! 84: wm protocol $win delete "BudgetCancel" ! 85: wm transient $win $head ! 86: ! 87: label $win.label\ ! 88: -borderwidth 1\ ! 89: -relief raised\ ! 90: -font [Font $win Large]\ ! 91: -text {Micropolis has paused to set the budget...} ! 92: ! 93: SetHelp $win.label Budget.Label ! 94: ! 95: frame $win.rightframe\ ! 96: -borderwidth 0 ! 97: ! 98: frame $win.rightframe.roadframe\ ! 99: -borderwidth 1\ ! 100: -relief raised ! 101: ! 102: SetHelp $win.rightframe.roadframe Budget.Road ! 103: ! 104: label $win.rightframe.roadframe.label\ ! 105: -relief flat\ ! 106: -font [Font $win Large]\ ! 107: -text { Road Fund } ! 108: ! 109: frame $win.rightframe.roadframe.frame\ ! 110: -borderwidth 2\ ! 111: -relief flat ! 112: LinkWindow $win.road $win.rightframe.roadframe.frame ! 113: ! 114: label $win.rightframe.roadframe.frame.request\ ! 115: -relief flat\ ! 116: -font [Font $win Medium]\ ! 117: -text {100% of $0 = $0} ! 118: ! 119: scale $win.rightframe.roadframe.frame.fund\ ! 120: -command {BudgetSetRoadFund}\ ! 121: -font [Font $win Medium]\ ! 122: -orient horizontal\ ! 123: -showvalue false\ ! 124: -sliderlength 15\ ! 125: -to 100\ ! 126: -width 10 ! 127: ! 128: pack append $win.rightframe.roadframe.frame\ ! 129: $win.rightframe.roadframe.frame.fund {top frame center expand fill} \ ! 130: $win.rightframe.roadframe.frame.request {top frame center expand fill} ! 131: ! 132: pack append $win.rightframe.roadframe\ ! 133: $win.rightframe.roadframe.label {top frame center fillx} \ ! 134: $win.rightframe.roadframe.frame {top frame center expand fill} ! 135: ! 136: ! 137: frame $win.rightframe.fireframe\ ! 138: -borderwidth 1\ ! 139: -relief raised ! 140: ! 141: SetHelp $win.rightframe.fireframe Budget.Fire ! 142: ! 143: label $win.rightframe.fireframe.label\ ! 144: -font [Font $win Large]\ ! 145: -relief flat\ ! 146: -text {Fire Fund} ! 147: ! 148: frame $win.rightframe.fireframe.frame\ ! 149: -borderwidth 2\ ! 150: -relief flat ! 151: LinkWindow $win.fire $win.rightframe.fireframe.frame ! 152: ! 153: label $win.rightframe.fireframe.frame.request\ ! 154: -relief flat\ ! 155: -font [Font $win Medium]\ ! 156: -text {100% of $0 = $0} ! 157: ! 158: scale $win.rightframe.fireframe.frame.fund\ ! 159: -command {BudgetSetFireFund}\ ! 160: -font [Font $win Medium]\ ! 161: -orient horizontal\ ! 162: -showvalue false\ ! 163: -sliderlength 15\ ! 164: -to 100\ ! 165: -width 10 ! 166: ! 167: pack append $win.rightframe.fireframe.frame\ ! 168: $win.rightframe.fireframe.frame.fund {top frame center expand fill} \ ! 169: $win.rightframe.fireframe.frame.request {top frame center expand fill} ! 170: ! 171: pack append $win.rightframe.fireframe\ ! 172: $win.rightframe.fireframe.label {top frame center fillx} \ ! 173: $win.rightframe.fireframe.frame {top frame center expand fill} ! 174: ! 175: ! 176: frame $win.rightframe.policeframe\ ! 177: -borderwidth 1\ ! 178: -relief raised ! 179: ! 180: SetHelp $win.rightframe.policeframe Budget.Police ! 181: ! 182: label $win.rightframe.policeframe.label\ ! 183: -relief flat\ ! 184: -font [Font $win Large]\ ! 185: -text {Police Fund} ! 186: ! 187: frame $win.rightframe.policeframe.frame\ ! 188: -borderwidth 2\ ! 189: -relief flat ! 190: LinkWindow $win.police $win.rightframe.policeframe.frame ! 191: ! 192: label $win.rightframe.policeframe.frame.request\ ! 193: -relief flat\ ! 194: -font [Font $win Medium]\ ! 195: -text {100% of $0 = $0} ! 196: ! 197: scale $win.rightframe.policeframe.frame.fund\ ! 198: -command {BudgetSetPoliceFund}\ ! 199: -font [Font $win Medium]\ ! 200: -orient horizontal\ ! 201: -showvalue false\ ! 202: -sliderlength 15\ ! 203: -to 100\ ! 204: -width 10 ! 205: ! 206: pack append $win.rightframe.policeframe.frame\ ! 207: $win.rightframe.policeframe.frame.fund {top frame center expand fill}\ ! 208: $win.rightframe.policeframe.frame.request {top frame center expand fill} ! 209: ! 210: pack append $win.rightframe.policeframe\ ! 211: $win.rightframe.policeframe.label {top frame center fillx} \ ! 212: $win.rightframe.policeframe.frame {top frame center expand fill} ! 213: ! 214: ! 215: frame $win.rightframe.taxrateframe\ ! 216: -borderwidth 1\ ! 217: -relief raised ! 218: ! 219: SetHelp $win.rightframe.taxrateframe Budget.Tax ! 220: ! 221: label $win.rightframe.taxrateframe.label\ ! 222: -relief flat\ ! 223: -font [Font $win Large]\ ! 224: -text {Tax Rate} ! 225: ! 226: frame $win.rightframe.taxrateframe.frame\ ! 227: -borderwidth 2\ ! 228: -relief flat ! 229: ! 230: label $win.rightframe.taxrateframe.frame.rate\ ! 231: -relief flat\ ! 232: -font [Font $win Medium]\ ! 233: -text {7%} ! 234: LinkWindow $win.taxlabel $win.rightframe.taxrateframe.frame.rate ! 235: ! 236: scale $win.rightframe.taxrateframe.frame.scale\ ! 237: -command {BudgetSetTaxRate}\ ! 238: -font [Font $win Medium]\ ! 239: -orient horizontal\ ! 240: -showvalue false\ ! 241: -sliderlength 15\ ! 242: -to 20\ ! 243: -width 10 ! 244: LinkWindow $win.taxrate $win.rightframe.taxrateframe.frame.scale ! 245: ! 246: pack append $win.rightframe.taxrateframe.frame\ ! 247: $win.rightframe.taxrateframe.frame.scale {top frame center expand fill}\ ! 248: $win.rightframe.taxrateframe.frame.rate {top frame center expand fill} ! 249: ! 250: pack append $win.rightframe.taxrateframe\ ! 251: $win.rightframe.taxrateframe.label {top frame center fillx} \ ! 252: $win.rightframe.taxrateframe.frame {top frame center expand fill} ! 253: ! 254: ! 255: pack append $win.rightframe\ ! 256: $win.rightframe.roadframe {top frame center expand fill} \ ! 257: $win.rightframe.fireframe {top frame center expand fill} \ ! 258: $win.rightframe.policeframe {top frame center expand fill} \ ! 259: $win.rightframe.taxrateframe {top frame center expand fill} ! 260: ! 261: ! 262: frame $win.leftframe\ ! 263: -borderwidth 0 ! 264: ! 265: frame $win.leftframe.collectedframe\ ! 266: -borderwidth 1\ ! 267: -relief raised ! 268: ! 269: SetHelp $win.leftframe.collectedframe Budget.Collected ! 270: ! 271: label $win.leftframe.collectedframe.label\ ! 272: -relief flat\ ! 273: -font [Font $win Large]\ ! 274: -text {Taxes Collected} ! 275: ! 276: label $win.leftframe.collectedframe.value\ ! 277: -relief flat\ ! 278: -font [Font $win Medium]\ ! 279: -text {$0} ! 280: LinkWindow $win.collected $win.leftframe.collectedframe.value ! 281: ! 282: pack append $win.leftframe.collectedframe\ ! 283: $win.leftframe.collectedframe.label {top frame center fillx} \ ! 284: $win.leftframe.collectedframe.value {top frame center expand fill} ! 285: ! 286: frame $win.leftframe.cashflowframe\ ! 287: -borderwidth 1\ ! 288: -relief raised ! 289: LinkWindow $win.cashflow $win.leftframe.cashflowframe.value ! 290: ! 291: SetHelp $win.leftframe.cashflowframe Budget.Flow ! 292: ! 293: label $win.leftframe.cashflowframe.label\ ! 294: -relief flat\ ! 295: -font [Font $win Large]\ ! 296: -text {Cash Flow} ! 297: ! 298: label $win.leftframe.cashflowframe.value\ ! 299: -relief flat\ ! 300: -font [Font $win Medium]\ ! 301: -text {+$0} ! 302: ! 303: pack append $win.leftframe.cashflowframe\ ! 304: $win.leftframe.cashflowframe.label {top frame center fillx} \ ! 305: $win.leftframe.cashflowframe.value {top frame center expand fill} ! 306: ! 307: frame $win.leftframe.previousframe\ ! 308: -borderwidth 1\ ! 309: -relief raised ! 310: LinkWindow $win.previous $win.leftframe.previousframe.value ! 311: ! 312: SetHelp $win.leftframe.previousframe Budget.Previous ! 313: ! 314: label $win.leftframe.previousframe.label\ ! 315: -relief flat\ ! 316: -font [Font $win Large]\ ! 317: -text {Previous Funds} ! 318: ! 319: label $win.leftframe.previousframe.value\ ! 320: -relief flat\ ! 321: -font [Font $win Medium]\ ! 322: -text {$0} ! 323: ! 324: pack append $win.leftframe.previousframe\ ! 325: $win.leftframe.previousframe.label {top frame center fillx} \ ! 326: $win.leftframe.previousframe.value {top frame center expand fill} ! 327: ! 328: frame $win.leftframe.currentframe\ ! 329: -borderwidth 1\ ! 330: -relief raised ! 331: LinkWindow $win.current $win.leftframe.currentframe.value ! 332: ! 333: SetHelp $win.leftframe.currentframe Budget.Current ! 334: ! 335: label $win.leftframe.currentframe.label\ ! 336: -relief flat\ ! 337: -font [Font $win Large]\ ! 338: -text {Current Funds} ! 339: ! 340: label $win.leftframe.currentframe.value\ ! 341: -relief flat\ ! 342: -font [Font $win Medium]\ ! 343: -text {$0} ! 344: ! 345: pack append $win.leftframe.currentframe\ ! 346: $win.leftframe.currentframe.label {top frame center fillx} \ ! 347: $win.leftframe.currentframe.value {top frame center expand fill} ! 348: ! 349: pack append $win.leftframe\ ! 350: $win.leftframe.collectedframe {top frame center expand fill} \ ! 351: $win.leftframe.cashflowframe {top frame center expand fill} \ ! 352: $win.leftframe.previousframe {top frame center expand fill} \ ! 353: $win.leftframe.currentframe {top frame center expand fill} ! 354: ! 355: frame $win.bottomframe\ ! 356: -borderwidth 0 ! 357: ! 358: frame $win.bottomframe.voteframe \ ! 359: -borderwidth 0 \ ! 360: -relief raised ! 361: LinkWindow $win.voteframe $win.bottomframe.voteframe ! 362: ! 363: button $win.bottomframe.voteframe.continue\ ! 364: -text {Continue With These Figures}\ ! 365: -font [Font $win Large]\ ! 366: -relief raised \ ! 367: -command "DoVote $win Budget BudgetContinue {}" ! 368: LinkWindow $win.vote $win.bottomframe.voteframe.continue ! 369: ! 370: SetHelp $win.bottomframe.voteframe Budget.Continue ! 371: ! 372: pack append $win.bottomframe.voteframe\ ! 373: $win.bottomframe.voteframe.continue {top frame center fillx} ! 374: ! 375: BindVotingButton $win $win.bottomframe.voteframe.continue Budget ! 376: ! 377: button $win.bottomframe.reset\ ! 378: -text {Reset to Original Figures}\ ! 379: -font [Font $win Large]\ ! 380: -command "BudgetReset" ! 381: ! 382: SetHelp $win.bottomframe.reset Budget.Reset ! 383: ! 384: button $win.bottomframe.cancel\ ! 385: -text {Cancel Changes and Continue}\ ! 386: -font [Font $win Large]\ ! 387: -command "BudgetCancel" ! 388: ! 389: SetHelp $win.bottomframe.cancel Budget.Cancel ! 390: ! 391: button $win.bottomframe.timer\ ! 392: -text {Timeout in 0 seconds ...}\ ! 393: -font [Font $win Large]\ ! 394: -command "ToggleBudgetTimer" ! 395: LinkWindow $win.timer $win.bottomframe.timer ! 396: ! 397: SetHelp $win.bottomframe.timer Budget.AutoCancel ! 398: ! 399: button $win.bottomframe.autobudget\ ! 400: -text {Enable Auto Budget}\ ! 401: -font [Font $win Large]\ ! 402: -command "ToggleAutoBudget" ! 403: LinkWindow $win.autobudget $win.bottomframe.autobudget ! 404: ! 405: SetHelp $win.bottomframe.autobudget Budget.AutoBudget ! 406: ! 407: pack append $win.bottomframe\ ! 408: $win.bottomframe.voteframe {top frame center expand fillx}\ ! 409: $win.bottomframe.reset {top frame center expand fillx}\ ! 410: $win.bottomframe.cancel {top frame center expand fillx}\ ! 411: $win.bottomframe.timer {top frame center expand fillx}\ ! 412: $win.bottomframe.autobudget {top frame center expand fillx} ! 413: ! 414: pack append $win\ ! 415: $win.label {top frame center fillx} \ ! 416: $win.bottomframe {bottom frame center fillx} \ ! 417: $win.leftframe {left frame center expand fill} \ ! 418: $win.rightframe {right frame center expand fill} ! 419: ! 420: sim UpdateBudget ! 421: ! 422: update idletasks ! 423:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.