[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Introducing NoRezFrame 1.0 for GSoft



First the diatribe:

10 years ago I bought GSoft Basic. It was touted as the greatest thing to hit the Apple //gs world. It would allow you to do all things you dreamed of doing, SHR screen, Desktop programs, etc. I found out it was never going to be a compiled language. On a real //gs it's slow, the editor is weird, nay ridiculous. Open-Apple-F is for FIND, not delete a character, no if, ands, or buts about it. I was excited about the Desktop Examples. Hmmm I can't seem to do anything with them, oh wait, you need Rez, not included. It's going to be bundled with the never completed Toolbox Programming Tutorial. Oh yeah, the shell is crippled too. Great. Fantastic. So it sat and I lost interest...

I drank the beer, bought Opus II and am currently translating Toolbox Pascal to Gsoft. Disregarding the previous negativity, I will say that Opus II is WELL worth the money and should be bought by anyone considering programming the //gs. You should also get the Toolbox References. (A BIG thank you to Polymorph for StartupTools help!). So here it is:

NoRezFrame.  A resourceless desktop frame program that you can modify!

The program isn't commented extensively, or really that nice looking, but I'm sure you can figure it out. Please let me know of any glaring errors in protcol, etc. And if anyone has a spare Toolbox Reference #3 they're looking to donate/sell to a worthy cause....

      !-----------------
      !NoRezFrame 1.0 by Smohn Jith
      !
      !Portions copyright the Byte Works, Inc.
      !All rights reserved. (c) 1998
      !------------------
	
      TYPE TOOLSPEC
        TOOLNUMBER AS INTEGER
        MINVERSION AS INTEGER
      END TYPE

      ! Change ToolArray as needed

      TYPE STARTSTOPRECORD
        FLAGS AS INTEGER
        VIDEOMODE AS INTEGER
        RESFILEID AS INTEGER
        DPAGEHANDLE AS HANDLE
        NUMTOOLS AS INTEGER
        TOOLARRAY(14) AS TOOLSPEC
      END TYPE

      DIM TLPTR AS POINTER TO STARTSTOPRECORD
      DIM DONE AS BOOLEAN:! Flag value
      DIM MYEVENT AS EVENTRECORD:! Event Record
      DIM STARTSTOPPARAM AS LONG :! tool startup/shutdown information
      DIM MYID AS INTEGER :! Memory ID
      DIM WHERE AS INTEGER :! Where event took place
      DIM WPTR AS GRAFPORTPTR:! Current grafport

      ALLOCATE (WPTR)

      ! Main program
      CALL STARTDESKTOP
      CALL INITMENUS
      INITCURSOR
      DONE = FALSE
      MYEVENT.TASKMASK = $001F7FF
      DO
        EVENT = TASKMASTER (EVERYEVENT, MYEVENT)
        SELECT CASE EVENT
          CASE WINSPECIAL, WINMENUBAR: CALL HANDLEMENU(MYEVENT.TASKDATA)
        END SELECT

      LOOP UNTIL DONE

      DISPOSE (WPTR)
      SHUTDOWNTOOLS (0, STARTSTOPPARAM)
      DISPOSE (TLPTR)
      END

      !----------------------
      ! Initialize menus.
      !
      ! Apple menu 1
      ! File menu  2
      ! Edit menu  3
      !----------------------

      SUB INITMENUS

      DIM HEIGHT AS INTEGER
      DIM MENUHAND AS MENUHANDLE
      DIM S AS STRINGPTR

      ALLOCATE (S)

      S^ = ">> Edit \N3" + CHR$ (13)
      S^ = S^ + "--Undo \N250*Zz" + CHR$ (13)
      S^ = S^ + "--Cut  \N251*Xx" + CHR$ (13)
      S^ = S^ + "--Copy \N252*Cc" + CHR$ (13)
      S^ = S^ + "--Paste \N253*Vv" + CHR$ (13)
      S^ = S^ + "--Clear \N254" + CHR$ (13)
      S^ = S^ + "." + CHR$ (13)

      MENUHAND = NEWMENU (S)
      INSERTMENU (MENUHAND, 0)


      S^ = ">> File \N2" + CHR$ (13)
      S^ = S^ + "--Close \N255*Ww" + CHR$ (13)
      S^ = S^ + "--Quit \N256*Qq" + CHR$ (13)
      S^ = S^ + "." + CHR$ (13)

      MENUHAND = NEWMENU (S)
      INSERTMENU (MENUHAND, 0)

      S^ = ">>@\XN1" + CHR$ (13)
      S^ = S^ + "--About...\N257V" + CHR$ (13)
      S^ = S^ + "." + CHR$ (13)
      MENUHAND = NEWMENU (S)
      INSERTMENU (MENUHAND, 0)

      FIXAPPLEMENU (1)
      HEIGHT = FIXMENUBAR
      DRAWMENUBAR
      DISPOSE (S)
      END SUB

      !--------------------
      ! Handle menu choices
      !--------------------

      SUB HANDLEMENU(TASKDATA AS LONG )

      SHARED DONE
      DIM MENUNUM AS INTEGER
      DIM MENUITEMNUM AS INTEGER

      MENUNUM = HIWORD (TASKDATA)
      MENUITEMNUM = LOWORD (TASKDATA)

      SELECT CASE MENUITEMNUM
        CASE 256:DONE = TRUE
        CASE 257: CALL DOABOUT
      END SELECT

      HILITEMENU (FALSE, MENUNUM)

      END SUB

      !-----------------
      ! Build tool record and start tools
      !-----------------

      SUB STARTDESKTOP
      SHARED STARTSTOPPARAM, TLPTR

      ALLOCATE (TLPTR)

      TLPTR^.NUMTOOLS = 14
      TLPTR^.VIDEOMODE = 640

      ! Misc Tool
      TLPTR^.TOOLARRAY(0).TOOLNUMBER = 3
      TLPTR^.TOOLARRAY(0).MINVERSION = $0302

      ! Quickdraw II
      TLPTR^.TOOLARRAY(1).TOOLNUMBER = 4
      TLPTR^.TOOLARRAY(1).MINVERSION = $0307

      ! Desk Manager
      TLPTR^.TOOLARRAY(2).TOOLNUMBER = 5
      TLPTR^.TOOLARRAY(2).MINVERSION = $0304

      ! EventManager
      TLPTR^.TOOLARRAY(3).TOOLNUMBER = 6
      TLPTR^.TOOLARRAY(3).MINVERSION = $0301

      ! Integer Math Tool
      TLPTR^.TOOLARRAY(4).TOOLNUMBER = 11
      TLPTR^.TOOLARRAY(4).MINVERSION = $0300

      ! Window Manager
      TLPTR^.TOOLARRAY(5).TOOLNUMBER = 14
      TLPTR^.TOOLARRAY(5).MINVERSION = $0303

      ! Menu Manager
      TLPTR^.TOOLARRAY(6).TOOLNUMBER = 15
      TLPTR^.TOOLARRAY(6).MINVERSION = $0303

      ! Control Manager
      TLPTR^.TOOLARRAY(7).TOOLNUMBER = 16
      TLPTR^.TOOLARRAY(7).MINVERSION = $0303

      ! Quickdraw Aux
      TLPTR^.TOOLARRAY(8).TOOLNUMBER = 18
      TLPTR^.TOOLARRAY(8).MINVERSION = $0304

      ! LineEdit Tool
      TLPTR^.TOOLARRAY(9).TOOLNUMBER = 20
      TLPTR^.TOOLARRAY(9).MINVERSION = $0303

      ! Dialog Manager
      TLPTR^.TOOLARRAY(10).TOOLNUMBER = 21
      TLPTR^.TOOLARRAY(10).MINVERSION = $0304

      ! Scrap Manager
      TLPTR^.TOOLARRAY(11).TOOLNUMBER = 22
      TLPTR^.TOOLARRAY(11).MINVERSION = $0301

      ! SFO
      TLPTR^.TOOLARRAY(12).TOOLNUMBER = 23
      TLPTR^.TOOLARRAY(12).MINVERSION = $0303

      ! Font Manager
      TLPTR^.TOOLARRAY(13).TOOLNUMBER = 27
      TLPTR^.TOOLARRAY(13).MINVERSION = $0303

      ! List Manager
      TLPTR^.TOOLARRAY(14).TOOLNUMBER = 28
      TLPTR^.TOOLARRAY(14).MINVERSION = $0303

      ! Start tools

      MYID = MMSTARTUP

      STARTSTOPPARAM = STARTUPTOOLS (MYID, 0, TLPTR)
      IF TOOLERROR <> 0 THEN
        PRINT "Could not start the tools! ToolError = "; TOOLERROR
        STOP
      END IF

      END SUB

      !----------------------
      ! About box without Rez
      !----------------------

      SUB DOABOUT

      DIM ASTRING AS STRINGPTR
      DIM BUTT AS INTEGER

      ALLOCATE (ASTRING)

      ASTRING^ = "43/"
      ASTRING^ = ASTRING^ + "NoRezFrame 1.0" + CHR$ (13)
      ASTRING^ = ASTRING^ + "by Smohn Jith" + CHR$ (13)
      ASTRING^ = ASTRING^ + CHR$ (13)
ASTRING^ = ASTRING^ + "Portions (c) 1998 Byte Works, Inc." + CHR$ (13)
      ASTRING^ = ASTRING^ + "All rights reserved." + CHR$ (13)
      ASTRING^ = ASTRING^ + "/^#0"

      BUTT = ALERTWINDOW ($0000, NIL , ASTRING)
      DISPOSE(ASTRING)
      END SUB