#!/usr/bin/newlisp # # Copyright (c) 1993-1997, Silicon Graphics, Inc. # ALL RIGHTS RESERVED # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the above # copyright notice appear in all copies and that both the copyright notice # and this permission notice appear in supporting documentation, and that # the name of Silicon Graphics, Inc. not be used in advertising # or publicity pertaining to distribution of the software without specific, # written prior permission. # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, # INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR # FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON # GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, # SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY # KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, # LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF # THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. # US Government Users Restricted Rights # Use, duplication, or disclosure by the Government is subject to # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph # (c)(1)(ii) of the Rights in Technical Data and Computer Software # clause at DFARS 252.227-7013 and/or in similar or successor # clauses in the FAR or the DOD or NASA FAR Supplement. # Unpublished-- rights reserved under the copyright laws of the # United States. Contractor/manufacturer is Silicon Graphics, # Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. # # OpenGL(R) is a registered trademark of Silicon Graphics, Inc. #------------------------------------------------------ # Conversion to newLisp by Peter van Eerten. # # This is a 1-to-1 port of the original program. # October 24, 2005. # # Revised for newLisp 8.9.0 at september 28, 2006. #------------------------------------------------------ (load "freeglut.lsp") (define (controltltop obj value) (if (and (!= value GLUT:MUI_SLIDER_RETURN) (!= value GLUT:MUI_SLIDER_THUMB)) () (begin (set 'sliderval (first (unpack "f" (pack "ld" (GLUT:muiGetVSVal obj))))) (GLUT:muiSetTLTop tl (flt sliderval)) ) ) ) (constant 'THUMBHEIGHT 20) (constant 'ARROWSPACE 40) (define (menucallback x) (println (append "menu callback: " (string x))) ) (define (maketestmenus) (set 'M1 (GLUT:glutCreateMenu 'menucallback)) (GLUT:glutAddMenuEntry "Open" 1) (GLUT:glutAddMenuEntry "Close" 2) (GLUT:glutAddMenuEntry "Read" 3) (set 'M2 (GLUT:glutCreateMenu 'menucallback)) (GLUT:glutAddMenuEntry "Edit" 4) (GLUT:glutAddMenuEntry "Cut" 5) (GLUT:glutAddMenuEntry "Paste" 6) (set 'M3 (GLUT:glutCreateMenu 'menucallback)) (GLUT:glutAddMenuEntry "Help1" 7) (GLUT:glutAddMenuEntry "Help2" 8) (GLUT:glutAddMenuEntry "Help3" 9) ) (define (bcallback obj r) # obj = obj; r = r; /* for lint's sake */ (println "Test 3 callback") ) (define (maketestui) (set 'xmin " ") (set 'ymin " ") (set 'xmax " ") (set 'ymax " ") (maketestmenus) (GLUT:muiNewUIList 1) # makes an MUI display list (number 1) (set 'b1 (GLUT:muiNewButton 10 100 10 35)) (set 'b2 (GLUT:muiNewButton 10 100 40 65)) (set 'b3 (GLUT:muiNewButton 10 100 70 95)) (set 'rb1 (GLUT:muiNewRadioButton 10 380)) (GLUT:muiLoadButton rb1 "Radio1") (set 'rb2 (GLUT:muiNewRadioButton 10 350)) (GLUT:muiLoadButton rb2 "Radio2") (set 'rb3 (GLUT:muiNewRadioButton 10 320)) (GLUT:muiLoadButton rb3 "Radio3") (GLUT:muiLinkButtons rb1 rb2) (GLUT:muiLinkButtons rb2 rb3) (set 'trb1 (GLUT:muiNewTinyRadioButton 10 450)) (GLUT:muiLoadButton trb1 "TRadio1") (set 'trb2 (GLUT:muiNewTinyRadioButton 10 430)) (GLUT:muiLoadButton trb2 "TRadio2") (set 'trb3 (GLUT:muiNewTinyRadioButton 10 410)) (GLUT:muiLoadButton trb3 "TRadio3") (GLUT:muiLinkButtons trb1 trb2) (GLUT:muiLinkButtons trb2 trb3) (set 't (GLUT:muiNewTextbox 110 250 50)) (GLUT:muiSetActive t 1) (set 't1 (GLUT:muiNewTextbox 110 270 20)) (set 'l (GLUT:muiNewLabel 110 85 "Label")) (set 'l1 (GLUT:muiNewBoldLabel 110 110 "Bold Label")) (set 'tl (GLUT:muiNewTextList 20 120 200 9)) (GLUT:muiGetObjectSize tl (address xmin) (address ymin) (address xmax) (address ymax)) (set 'vs (GLUT:muiNewVSlider (get-int xmax) (+ (get-int ymin) 2) (get-int ymax) 0 THUMBHEIGHT)) (set 'hs (GLUT:muiNewHSlider 20 290 280 0 THUMBHEIGHT)) (GLUT:muiSetVSValue vs 1.0) (GLUT:muiSetVSArrowDelta vs (flt (div (- (- (- (- (get-int ymax) (get-int ymin)) 10) THUMBHEIGHT) ARROWSPACE) (- (div 30 4) 9) ))) (GLUT:muiLoadButton b1 "Test") (GLUT:muiLoadButton b2 "Test22") (GLUT:muiLoadButton b3 "Test3") (GLUT:muiSetCallback b3 'bcallback) (set 'pd (GLUT:muiNewPulldown)) (GLUT:muiAddPulldownEntry pd "File" M1 0) (GLUT:muiAddPulldownEntry pd "Edit" M2 0) (GLUT:muiAddPulldownEntry pd "Help" M3 1) (constant 'strs (pack "ldldldldldldldldldldldldldldldldldldldldldldldldldldldldldld" (address "Line 1") (address "Line 2") (address "Longer line 3") (address "Very, very, very long line number four") (address "Line 5") (address "Sixth line") (address "Seventh line") (address "Line number 8") (address "9") (address "10") (address "The eleventh line") (address "line 12") (address "Line number 13") (address "Quite long line 14") (address "15") (address "Line 1") (address "Line 2") (address "Longer line 3") (address "Very, very, very long line number four") (address"Line 5") (address "Sixth line") (address "Seventh line") (address "Line number 8") (address "9") (address "10") (address "The eleventh line") (address "line 12") (address "Line number 13") (address "Quite long line 14") (address "15"))) (GLUT:muiSetTLStrings tl (address strs)) (GLUT:muiSetCallback vs 'controltltop) ) (define (main argc argv) (GLUT:glutInit (address argc) (address argv)) # if (argc > 1) mui_singlebuffered = 1; (GLUT:glutInitWindowPosition 100 100) (GLUT:glutInitWindowSize 300 500) (if (= mui_singlebuffered 1) (GLUT:glutInitDisplayMode (| GLUT:GLUT_RGB GLUT:GLUT_SINGLE)) (GLUT:glutInitDisplayMode (| GLUT:GLUT_RGB GLUT:GLUT_DOUBLE)) ) (GLUT:glutCreateWindow "test") (maketestui) (GLUT:muiInit) (GLUT:glutMainLoop) ) (main 0 0) (exit)