#!/bin/sh # Start wish \ exec wish8.3 "$0" "$@" # PHP implementation of TPC-W # # Copyright (c) 2004, Jan Wieck # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose, without fee, and without a # written agreement is hereby granted, provided that the above # copyright notice and this paragraph and the following two # paragraphs appear in all copies. # # IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, # INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, # INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE # AND ITS DOCUMENTATION, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. # # THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED # HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO # OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, # ENHANCEMENTS, OR MODIFICATIONS. # # generate_buttons.tk # # wish8.3 script to generate the GIF images for the navigation # buttons and the "What's new" and "Best Sellers" # # This script needs the pbmtools installed and must run under X # Change the working directory to where we need to run cd [file dirname $argv0] puts "pwd now is: [pwd]" # Destination directory for the images set basedir ../html/tpcw/images # Font and size in pixels for the labels set label_font "-adobe-helvetica-bold-o-normal-*-34-*-*-*-*-*-*-*" set label_width 200 set label_height 40 # Font and size in characters for the buttons set button_font "-adobe-helvetica-bold-r-normal-*-18-*-*-*-*-*-*-*" set button_width 16 catch {file mkdir $basedir} file copy ./tpclogo.gif $basedir/tpclogo.gif proc make_label {text imgname} { upvar #0 label_font font upvar #0 label_width wid upvar #0 label_height ht canvas .c -width $wid -height $ht \ -borderwidth 0 -highlightthickness 0 \ -background white pack .c set x [expr $wid / 2] set y [expr $ht / 2] .c create text $x $y -text $text -font $font \ -fill black -anchor c incr x 2 incr y 2 .c create text $x $y -text $text -font $font \ -fill goldenrod -anchor c -tags gr .c lower gr update exec xwd -id [winfo id .c] | xwdtopnm | ppmtogif 2>/dev/null >$imgname destroy .c } proc make_button {text imgname} { upvar #0 button_font font upvar #0 button_width wid button .b -borderwidth 4 -relief raised \ -font $font -highlightthickness 0 \ -background goldenrod \ -text $text -width $wid pack .b update exec xwd -id [winfo id .b] | xwdtopnm | ppmtogif 2>/dev/null >$imgname destroy .b } make_label "What's New" $basedir/whats_new.gif make_label "Best Sellers" $basedir/best_sellers.gif make_button "Shopping Cart" $basedir/shopping_cart.gif make_button "Search" $basedir/search.gif make_button "Order Status" $basedir/order_status.gif make_button "Checkout" $basedir/checkout.gif make_button "Home" $basedir/home.gif make_button "Refresh" $basedir/refresh.gif make_button "Submit" $basedir/submit.gif make_button "Process Order" $basedir/process_order.gif make_button "Add to Cart" $basedir/add_to_cart.gif make_button "Update" $basedir/update.gif make_button "Submit Changes" $basedir/submit_changes.gif make_button "Display Last Order" $basedir/display_last_order.gif destroy .