home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Super Store 3.0 / TESTDRIVE_3.ISO / realizer / preview.rlz < prev    next >
Encoding:
Text File  |  1992-09-30  |  10.5 KB  |  365 lines

  1. '***********************************************************************
  2. '    Preview.RLZ
  3. '
  4. '    Copyright ⌐ 1991-1992 Computer Associates International, Inc.
  5. '    All rights reserved.
  6. '
  7. '***********************************************************************
  8.  
  9. TRUE = 1
  10. FALSE = 0
  11. SetSys(_Size, {_Maximize})
  12. RUN "Animate"
  13.  
  14. FUNC FDT_Preview (b_firstTime)
  15.     LOCAL    preview_mode
  16.     LOCAL    title_delay, bmp_delay, read_delay, screen_delay
  17.     LOCAL    save_loadDir, save_macDir
  18.     LOCAL    fontHeading, fontHeadingHt, fontType, fontTypeHt
  19.     LOCAL    fontHilite, fontHiliteHt, fontSmall, fontSmallHt
  20.     LOCAL    fdtExists, selection, result
  21.     LOCAL    tf, thisOne, icon_name, s1, s2, maxRight
  22.     LOCAL    CRLF, rsID, lf, lfPct, tp, tpPct, frameNum
  23.  
  24.     preview_mode = 0    ' normal
  25. ''    preview_mode = 1    ' automatic, does not show Next/Main Menu buttons.
  26. ''    preview_mode = 2    ' test, Delay button instead of IDLE
  27. ''    preview_mode = 3    ' blazes through delays, 1 BEEP per
  28. ''    preview_mode = 4    ' blazing automatic
  29.  
  30.     title_delay = 2
  31.     bmp_delay = 3
  32.     read_delay = 6
  33.     screen_delay = 10        ' only matters when preview_mode = 1
  34.     CRLF = Chr$(13) + Chr$(10)
  35.  
  36.     FUNC QL (rsID)
  37.         RETURN FormQObject(rsID)[_FQO_Left]
  38.     END FUNC
  39.     FUNC QT (rsID)
  40.         RETURN FormQObject(rsID)[_FQO_Top]
  41.     END FUNC
  42.     FUNC QW (rsID)
  43.         RETURN FormQObject(rsID)[_FQO_Width]
  44.     END FUNC
  45.     FUNC QH (rsID)
  46.         RETURN FormQObject(rsID)[_FQO_Height]
  47.     END FUNC
  48.     FUNC QR (rsID)
  49.         LOCAL    v
  50.         v = FormQObject(rsID)
  51.         RETURN v[_FQO_Left] + v[_FQO_Width]
  52.     END FUNC
  53.     FUNC QB (rsID)
  54.         LOCAL    v
  55.         v = FormQObject(rsID)
  56.         RETURN v[_FQO_Top] + v[_FQO_Height]
  57.     END FUNC
  58.  
  59.     PROC Delay (rsTime)
  60.         LOCAL    J
  61.  
  62.         SELECT CASE preview_mode
  63.         CASE 0, 1
  64.             IDLE rsTime
  65.         CASE 2
  66.             FormSetColor(_Turquoise; _Field)
  67.             FormSetObject(10101, _Button, SPRINT("Delay P(0)", rsTime), _Right, _Bottom)
  68.             IF FormWait() THEN
  69.             END IF
  70.             FormModifyObject(10101, _Close)
  71.         CASE 3, 4
  72.             FOR J = 1 TO rsTime
  73.                 BEEP
  74.             NEXT
  75.         END SELECT
  76.     END PROC
  77.  
  78.     PROC DoDelayCapt (capt)
  79.         FormSetObject(rsID, _CaptionLeft, "- " + capt, fontType, lf, tpPct pct)
  80.         rsID = rsID + 1
  81.         tpPct = tpPct + 7
  82.         Delay(1)
  83.     END PROC
  84.  
  85.     PROC DelayBmp (rsID, bmName, lf, tp)
  86.         FormSetObject(rsID, _Bitmap, bmName, lf, tp)
  87.         FormModifyObject(rsID, _Gray)
  88.         Delay(bmp_delay)
  89.     END PROC
  90.  
  91.     PROC DoIcoCapt (bmName, capt)
  92.         FormSetObject(rsID, _Bitmap, bmName, lfPct pct, tpPct pct)
  93.         FormModifyObject(rsID, _Gray)
  94.         FormSetObject(rsID+1, _CaptionLeft, capt, fontType, lfPct + 7 pct, tpPct + 1 pct)
  95.         tpPct = tpPct + 10
  96.         rsID = rsID + 2
  97.         Delay(1)
  98.     END PROC
  99.  
  100.     PROC BuildForm (rsID)
  101.         FormNew(rsID; "", _Close)
  102.         FormControl(_Size; _Center, _Center, 97pct, 95pct)
  103.         FormSetColor(_Turquoise)
  104.         FormSetColor(_Turquoise; _Field)
  105.         FormSetObject(5, _CaptionLeft, "x", _Right, 0)
  106.         maxRight = QR(5)
  107.         FormSetObject(5, _Bitmap, icon_name, _Left, _Top, 50, 50)
  108.         FormModifyObject(5, _Gray)
  109.         FormSetObject(1, _Button, "x", 100pct, 100pct)    'focus eater
  110.         FormControl(_Show)
  111.     END PROC
  112.  
  113.     PROC RollStart (iconName)
  114.         icon_name = iconName
  115.         tf[1] = FormQUnique()
  116.         tf[2] = FormQUnique()
  117.         thisOne = tf[1]
  118.         BuildForm(tf[1])
  119.         FormControl(_Show)
  120.     END PROC
  121.  
  122.     FUNC RollWait (rw_mode)
  123.         ' rw_mode    0: just Main Menu
  124.         '        1: Main Menu and Next, Closes form and returns 0 if user hits Main Menu.
  125.         '        2: just Main Menu, surrounded by a _Cyan _GroupBox
  126.         LOCAL    tv, extra, oldOne
  127.  
  128.         IF preview_mode = 1 OR preview_mode = 4 THEN
  129.             Delay(screen_delay)
  130.         ELSE
  131.             FormSetColor(_Turquoise; _Field)
  132.             IF rw_mode <> 1 THEN
  133.                 IF rw_mode = 0 THEN
  134.                     FormSetObject(1, _DefButton, "Main Menu", _Right, _Bottom)
  135.                 ELSE
  136.                     FormSetColor(_Cyan; _Field)
  137.                     FormSetObject(1, _DefButton, "Main Menu", 100pct, 100pct)
  138.                     tv = FormQObject(1)
  139.                     extra = tv[_FQO_Height] \ 2
  140.                     FormSetObject(400, _GroupBox, "", _Right, _Bottom, tv[_FQO_Width] + 2 * extra, tv[_FQO_Height] + 2 * extra)
  141.                     tv = FormQObject(400)
  142.                     FormSetObject(1, _DefButton, "Main Menu", tv[_FQO_Left] + extra, tv[_FQO_Top] + extra)
  143.                 END IF
  144.                 IF FormWait() THEN
  145.                 END IF
  146.             ELSE
  147.                 FormSetObject(2, _Button, "Main Menu", 100pct, 100pct)
  148.                 FormSetObject(1, _DefButton, "Next", _Right, _Bottom, QW(2), _Default)
  149.                 FormModifyObject(1, _SetFocus)
  150.                 FormModifyObject(2, _Normal, QL(1) - QW(1) - (QL(2) - QR(1)), _Bottom)
  151.                 IF FormWait() = 2 THEN
  152.                     FormControl(_Close)
  153.                     RETURN FALSE
  154.                 END IF
  155.             END IF
  156.         END IF
  157.         IF rw_mode <> 1 THEN
  158.             FormControl(_Close)
  159.             RETURN TRUE
  160.         ELSE
  161.             oldOne = thisOne
  162.             thisOne = IF thisOne = tf[1] THEN tf[2] ELSE tf[1]
  163.             BuildForm(thisOne)
  164.             FormSelect(oldOne)
  165.             FormControl(_Close)
  166.             FormSelect(thisOne)
  167.             RETURN TRUE
  168.         END IF
  169.     END FUNC
  170.  
  171.     PROC CyanBox (rsID, font, lf, tp, nLines, sMeasure, sFull)
  172.         LOCAL    tv, wd, fht, ht
  173.         FormSetObject(rsID, _CaptionLeft, sMeasure + " ", font, 100pct, 100pct)
  174.         tv = FormQObject(rsID)
  175.         wd = tv[_FQO_Width]
  176.         fht = tv[_FQO_Height]
  177.         ht = nLines * fht
  178.         FormSetColor(_Cyan; _Field)
  179.         FormSetObject(rsID, _GroupBox, "", lf, tp, wd + fht, ht + fht)
  180.         tv = FormQObject(rsID)
  181.         FormSetObject(rsID+1, _CaptionLeft, sFull, font, tv[_FQO_Left] + fht\2, tv[_FQO_Top] + 5*fht\12, wd, ht)
  182.         FormSetColor(_Turquoise; _Field)
  183.     END PROC
  184.  
  185.     PROC DoBmpCapt (bmName, capt)
  186.         IF bmName = "" THEN
  187.             rsID = 140
  188.             AnimateControl(_Start)
  189.         ELSE
  190.             FormSetObject(rsID, _Bitmap, bmName, lfPct pct, tpPct pct)
  191.             FormModifyObject(rsID, _Gray)
  192.         END IF
  193.         FormSetObject(rsID+1, _CaptionLeft, capt, fontType, lfPct + 8 pct, tpPct + 1 pct)
  194.         rsID = rsID + 2
  195.         lfPct = lfPct + 5
  196.         tpPct = tpPct + 13
  197.         Delay(1)
  198.     END PROC
  199.  
  200.     FUNC MainMenu (focusButton)
  201.         LOCAL    result
  202.  
  203.         IF preview_mode = 1 OR preview_mode = 4 THEN
  204.             IF focusButton = 120 THEN
  205.                 RETURN 100
  206.             ELSE
  207.                 RETURN focusButton
  208.             END IF
  209.         END IF
  210.         FormNew(FormQUnique(); "", _Close)
  211.         FormControl(_Size; _Center, _Center, 97 pct, 65 pct)
  212.         FormSetColor(_Turquoise; _Background)
  213.  
  214.         FormSetColor(_Turquoise; _Field)
  215.         FormSetObject(5, _Bitmap, "RlzIcon.BMP", _Left, _Top, 50, 50)
  216.         FormModifyObject(5, _Gray)
  217.         FormSetObject(10, _CaptionLeft, "Main Menu", fontHeading, _Center, 1 pct)
  218.         s1 = "The Overviews will introduce you to some of Realizer's features."
  219.         s2 = "The Tutorial will teach you how to build a simple application."
  220.         FormSetObject(20, _CaptionLeft, s1, fontType, _Center, 19 pct)
  221.         FormSetObject(30, _CaptionLeft, s2, fontType,  QL(20), 27 pct)
  222.         IF NOT QVar(fdt_steps) AND focusButton <> 120 THEN
  223.             s1 = "Use the space bar to step through the Overviews in sequence."
  224.             FormSetObject(40, _CaptionCenter, s1, fontHilite, QL(20), 36pct, QW(20), _Default)
  225.         END IF
  226.  
  227.         PROC DoButtons (rsID, title, bmName, lf, tp)
  228.             FormSetObject(rsID, _Button, title, lf pct, tp pct, 25 pct, _Default)
  229.             FormSetObject(rsID+1, _BitmapButton, bmName, lf-7 pct, tp pct)
  230.             FormModifyObject(rsID+1, _Gray)
  231.         END PROC
  232.  
  233.         DoButtons(130, "Introduction", "RlzIcon.BMP", 20, 50)
  234.         DoButtons(100, "Realizer Overview", "RlzIcon.BMP", 20, 70)
  235.         DoButtons(110, "FormDev Overview", "FDevIcon.BMP", 60, 50)
  236.         DoButtons(120, "FormDev Tutorial", "FDevIcon.BMP", 60, 70)
  237.         IF NOT fdtExists THEN
  238.             FormModifyObject(120, _Gray)
  239.         END IF
  240.         FormSetObject(2, _Button, "Quit", _Center, 88 pct, 15 pct, _Default)
  241.         FormModifyObject(focusButton, _SetFocus)
  242.         result = FormWait()
  243.         IF result = 1 THEN
  244.             result = FormQObject()[_FQO_ItemNum]
  245.         END IF
  246.         FormControl(_Close)
  247.         RETURN result
  248.     END FUNC
  249.  
  250.     PROC Intro ()
  251.         LOCAL    wd
  252.  
  253.         RollStart("RlzIcon")
  254.         FormSetObject(10, _CaptionLeft, "Welcome to Realizer...", fontHeading, 50 pct, 100 pct)
  255.         FormSetObject(20, _CaptionLeft, " The Complete", fontType, 100 pct, 100 pct)
  256.         wd = QW(10) + QW(20)
  257.         FormModifyObject(10, _Gray, QL(10) - wd\2, 1pct)
  258.         FormModifyObject(20, _Gray, QR(10), QT(10) + 2*fontTypeHt\3)
  259.         s1 = "Application Development Environment for Windows."
  260.         FormSetObject(30, _CaptionCenter, s1, fontType, _Center, QB(10) + fontTypeHt\5)
  261.         Delay(title_delay)
  262.  
  263.         DelayBmp(101, "Chart2", _Left, 18 pct)
  264.         DelayBmp(102, "Expense", 50 pct, 20 pct)
  265.         DelayBmp(103, "Chart1", 2 pct, 55 pct)
  266.         DelayBmp(104, "Sheet", 25 pct, 48 pct)
  267.  
  268.         CyanBox(200, fontHilite, _Right, _Center, 4, "professional Windows applications,", "Realizer makes it easy to build professional Windows applications, even if you know little about Windows or programming.")
  269.         Delay(read_delay)
  270.         FormModifyObject(200, _Close)
  271.         FormModifyObject(201, _Close)
  272.  
  273.         s1 = "Realizer combines a structured superset of BASIC, "
  274.         s2 = " visual interface design, and high-level building block tools, making it the easiest"
  275.         s2 = s2 + " and most powerful Windows development system."
  276.         CyanBox(200, fontHilite, 1 pct, 70 pct, 4, s1, s1 + s2)
  277.         Delay(read_delay)
  278.  
  279.         IF RollWait(2) THEN
  280.         END IF
  281.     END PROC
  282.  
  283.  
  284.     save_loadDir = QSys(_LoadDir)
  285.     save_macDir = QSys(_MacroDir)
  286.  
  287.     IF QVar(fdt_steps) THEN
  288.         fdtExists = 1
  289.     ELSE
  290.         SetSys(_LoadDir, save_macDir)
  291.         fdtExists = FileQ(FileQ("FD_TUTOR.RLZ", _Name), _Exists)
  292.     END IF
  293.  
  294.     SetSys(_LoadDir, QSys(_ProgDir) + "Demos\Preview")
  295.     SetSys(_MacroDir, QSys(_ProgDir) + "Demos\Preview")
  296.  
  297.     PROC DoFont (rsID, fontHt, fontName, fontSize, fontStyle)
  298.         rsID = FontQUnique()
  299.         FontNew(rsID; fontName, fontSize, fontStyle)
  300.         FormSetObject(1, _CaptionLeft, "x", rsID, 0, 0)
  301.         fontHt = QH(1)
  302.     END PROC
  303.  
  304.     FormNew(FormQUnique())
  305.     DoFont(fontHeading, fontHeadingHt, "Helv", 24, _Bold)
  306.     DoFont(fontType, fontTypeHt, "Helv", 12, _Bold)
  307.     DoFont(fontHilite, fontHiliteHt, "Helv", 10, 0)
  308.     DoFont(fontSmall, fontSmallHt, "Helv", 8, _Bold)
  309.     FormControl(_Close)
  310.  
  311.     IF b_firstTime THEN
  312.         selection = 130
  313.         b_firstTime = FALSE
  314.     ELSE
  315.         selection = MainMenu(120)
  316.     END IF
  317.     LOOP
  318.         SELECT CASE selection
  319.         CASE 100    ' Realizer overview
  320.             RUN "RlzOver"
  321.             selection = MainMenu(110)
  322.         CASE 110    ' FormDev overview
  323.             RUN "FDevOver"
  324.             selection = MainMenu(120)
  325.         CASE 120    ' FormDev Tutorial
  326.             result = 12
  327.             EXIT LOOP
  328.         CASE 130    ' Introduction
  329.             Intro()
  330.             selection = MainMenu(100)
  331.         CASE 2    ' Quit
  332.             result = 11
  333.             EXIT LOOP
  334.         CASE ELSE
  335.             selection = MainMenu(100)
  336.         END SELECT
  337.     END LOOP
  338.  
  339.     SetSys(_LoadDir, save_loadDir)
  340.     SetSys(_MacroDir, save_macDir)
  341.     FontSelect(fontHeading)
  342.     FontControl(_Close)
  343.     FontSelect(fontType)
  344.     FontControl(_Close)
  345.     FontSelect(fontHilite)
  346.     FontControl(_Close)
  347.     FontSelect(fontSmall)
  348.     FontControl(_Close)
  349.  
  350.     RETURN result
  351. END FUNC
  352.  
  353. LOCAL    fdt_preview_first
  354. fdt_preview_first = 1
  355. WHILE FDT_Preview(fdt_preview_first) = 12
  356.     fdt_preview_first = 0
  357.     RUN "FD_TUTOR"
  358.     IF QVar(fdt_steps) THEN
  359.         EXIT WHILE
  360.     END IF
  361. END WHILE
  362. IF NOT QVar(fdt_steps) THEN
  363.     RESET
  364. END IF
  365.