home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WINDMNGR.ZIP / WINDMNGR.DOC < prev    next >
Encoding:
Text File  |  1986-01-13  |  38.4 KB  |  1,381 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                           ETHE WINDOW MANAGER/EDITORF
  7.                                 VERSION 1.0
  8.                              COPYRIGHT (c) 1985
  9.                                      BY
  10.                                 JIM EVERINGHAM
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. THE WINDOW MANAGER                                                     PAGE   1
  61.  
  62.  
  63.           
  64.  
  65.                This Program is placed in the public domain by the  author 
  66.          and may be distributed freely without modification.  If you find 
  67.          these routines to be of use or of value,  a small donation of up 
  68.          to $10.00 would be appreciated.  Those who donate will recieve a 
  69.          complete description of the program source code and its updates.  
  70.          Donations, inquiries, criticisms, or suggestions can be sent to: 
  71.  
  72.  
  73.                                   Jim Everingham 
  74.                                   318 East Sheridan Avenue 
  75.                                   Dubois,  Pa 15801
  76.                                   (814)-238-9655 
  77.                                   CIS: 75116,433 
  78.  
  79.  
  80.                I am also working on an  assembler  window  package  as  a 
  81.          project.  Any suggestions will be welcome.  
  82.           
  83.          The Following Files should be included in the Library file:
  84.                               
  85.                         Include Files:
  86.  
  87.                                  E VAR.INCF
  88.                                  E WINDMNGR.INCF
  89.                                  E GROWWIN.INCF
  90.                                  E DEMODEFS.INCF
  91.           
  92.                         Demonstration Programs:
  93.                                  
  94.                                  E DEFDEMO.PASF
  95.                                  E DEFDEMO.COMF
  96.                                  E GROWDEMO.PASF
  97.                                  E GROWDEMO.COMF
  98.                                  E WINDDEMO.PASF
  99.                                  E WINDDEMO.COMF
  100.  
  101.                         Support Programs:
  102.  
  103.                                  E WINDODEF.PASF
  104.                                  E WINDODEF.COMF
  105.                                  E PRINTMAN.BATF
  106.          
  107.          And of course this file,E WINDMNGR.DOCF & EREAD.MEF
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. THE WINDOW MANAGER                                                     PAGE   2
  121.  
  122.  
  123.           
  124.  
  125.  
  126.          Contents
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                
  135.                Introduction .......................... Page  4
  136.  
  137.                System Requirements ................... Page  5
  138.  
  139.                Overview of the Window Manager ........ Pages 6 - 7
  140.  
  141.                The Window Manager Routines ........... Pages 8 -14
  142.  
  143.                Pre-Defining Windows .................. Pages 13-14, 17-18
  144.  
  145.                Other Functions & Procedures .......... Pages 15-16
  146.  
  147.                Using WINDODEF.COM .................... Pages 17-18
  148.  
  149.                Monochrome Graphics ................... Page  19
  150.  
  151.                Modifying the Source code ............. Page  20
  152.  
  153.                Quick Reference Section ............... Pages 21-22
  154.           
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. THE WINDOW MANAGER                                                     PAGE   3
  181.  
  182.  
  183.          
  184.                                    -EIntroductionF-
  185.           
  186.           
  187.               The Window Manager/Editor System is a collection  of  ultra-
  188.          fast  window  routines written in Turbo Pascal Under PC-Dos 2.0.  
  189.          These Routines make it very easy to add a variety  of  different 
  190.          size  and  type windows into your own Turbo Pascal programs. 
  191.               When using this manual, type in the example programs to get 
  192.          a feeling of how the program operates.
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240. THE WINDOW MANAGER                                                     PAGE   4
  241.  
  242.  
  243.           
  244.                                 -ESystem RequirementsF-
  245.  
  246.  
  247.               This Program was developed on a Columbia  MPC  1600-1  with 
  248.          256K  RAM  and a Color/Graphics adapter under PC DOS 2.0.  These 
  249.          routines will not work on a non-PC compatible system due to  the 
  250.          fact  that  it writes directly into video RAM.  I have tried the 
  251.          demos on an IBM PC and they have worked fine,  so I don't  think 
  252.          there will be any trouble getting them to work properly.  
  253.  
  254.          ENOTE:F If  when  running  the  demo's  consecutivly,  the  screen 
  255.          becomes  full  of garbage or unreadable characters,  just reboot 
  256.          your computer and they should work fine.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. THE WINDOW MANAGER                                                     PAGE   5
  301.  
  302.  
  303.           
  304.                    -EOverview of the Window Manager/Editor System F-
  305.  
  306.          
  307.               The  ability  to  create  "WINDOWS"  is  one  of  the  more 
  308.          fascinating features of the PC.  If you do not know exactly what 
  309.          windows are, I will try to explain the concept to you here.  
  310.  
  311.               A window can  be  thought  of  as  a  scrolling  area.  The 
  312.          standard  IBM  PC display consists (upon boot-up) of a scrolling 
  313.          area of 80 columns by 25 rows of characters.  This is a  window, 
  314.          whenever  the screen fills up,  it scrolls the whole screen up 1 
  315.          column allowing a blank column at the bottom of the screen.  The 
  316.          area in which to be scrolled is from column 1,  row 1 and column 
  317.          80,  row 25.  This scrolling area can be "SET" to any portion of 
  318.          the screen.  For example,  I can change the scrolling area to be 
  319.          from column 5, row 5 (upper left hand corner) and column 50, row 
  320.          20  (lower right hand corner,  see figure 1.0).  All text within 
  321.          that area (or window) will be  scrolled  and  the  rest  of  the 
  322.          screen will remain undisturbed.  
  323.  
  324.                   (1,1)          PC's Screen
  325.                     +---------------------------------------+
  326.                     |   (5,5)                               |
  327.                     |     +------------------+              |
  328.                     |     |                  |              |
  329.                     |     |                  |              |
  330.                     |     |    Area  A       |              |
  331.                     |     |                  |              |
  332.                     |     |                  |              |
  333.                     |     +------------------+              |
  334.                     |                     (50,20)           |
  335.                     |                                       |
  336.                     |          Area B                       |
  337.                     +---------------------------------------+
  338.                                                           (80,25)
  339.                      EFigure 1.0F, Screen. A=New Scrolling Area
  340.                                          B=Full viewing Area
  341.  
  342.               My new scrolling area is area A,  or a window consisting of 
  343.          the  upper-left  hand  coordinates  (5,5)  and  lower right hand 
  344.          coordinates  (50,20).  Now  whenever  I  write  to  the  screen, 
  345.          everything in area A is scrolled and area B, the main screen, is 
  346.          undisturbed  (Try  out  the  EDEFDEMO.COMF program to see how this 
  347.          works).  
  348.  
  349.               Windows  are  used in many popular programs.  Sidekick uses 
  350.          windows, Qmodem, Pc-Talk, many disk catalog programs, etc.  Many 
  351.          interesting effects can be created  with  use  of  windows.  For 
  352.          example  toggling  in between windows can create the illusion of 
  353.          many windows active on your  screen  at  once.  Windows  can  be 
  354.          created in text mode, and graphics mode also.  
  355.  
  356.                With the Window  Manager/Editor  system,  windows  can  be 
  357.          manipulated with the ease of a few new procedures which are used 
  358.          just  like  commands.  Among these are commands to add,  remove, 
  359.  
  360. THE WINDOW MANAGER                                                     PAGE   6
  361.  
  362.  
  363.          title, color, create,  scroll and move your windows around.  The 
  364.          details  of these procedures will be covered in the next section 
  365.          of this manual.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420. THE WINDOW MANAGER                                                     PAGE   7
  421.  
  422.  
  423.                
  424.                     -EImplementing Window Manager/Editor RoutinesF-
  425.  
  426.               This section will describe all routines included  with  the 
  427.          Window Manager/Editor system and detailed instructions on how to 
  428.          implement them into your own Turbo Pascal programs.  
  429.  
  430.               In all there are seven main commands to work with  (I  will 
  431.          refer  to  procedural  calls  as  "commands"  for  the  sake  of 
  432.          understanding).  
  433.  
  434.                                    1: INITIALIZE
  435.                                    2: ADD_WINDOW  
  436.                                    3: GROW_WINDOW (grow window?)
  437.                                    4: REMOVE
  438.                                    5: COLOR_WINDOW                      
  439.                                    6: WINDOW_TITLE
  440.                                    7: SELECT_WINDOW (Optional)
  441.  
  442.               To access these commands,  all that is required is that you 
  443.          include  the  following  two lines at the very beginning of your 
  444.          program: 
  445.           
  446.                                    {$I VAR.INC}
  447.                                    {$I WINDMNGR.INC}
  448.           
  449.          optional: {$I GROWWIN.INC} if you wish to use growing windows.
  450.                    {$I DEFS.INC} if you have defined windows (See section 
  451.                                  on EWINDODEF.COMF for details on this).
  452.  
  453.                We  will discuss the syntax of each of these in detail and 
  454.          then move onto the smaller functions  and  commands.  Parameters 
  455.          will be enclosed in the symbols < and > and in boldface.  
  456.  
  457.          E--Initialize--F Procedure
  458.          E--__________--F          
  459.  
  460.                Initializes  the  stack  and memory for your windows to be 
  461.          stored in.  This -MUST- be in your program before you use  any  of 
  462.          the other routines.  There is no telling what will happen if you 
  463.          don't.  
  464.  
  465.          Syntax:
  466.  
  467.                                     Initialize;
  468.  
  469.               I highly recommend getting into the habit  of  making  this 
  470.          the first line of your program.  
  471.  
  472.  
  473.          E--Add_Window--F Procedure
  474.          E--__________--F          
  475.           
  476.               Saves the current screen into memory and creates  a  framed 
  477.          window  with  the cursor positioned in the top left hand corner.  
  478.          
  479.          Syntax: 
  480.  
  481.  
  482. THE WINDOW MANAGER                                                     PAGE   8
  483.  
  484.  
  485.          Add_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
  486.  
  487.          Where:
  488.                          EX1F is upper left hand X-coordinate
  489.                          EY1F is upper left hand Y-coordinate
  490.                          EX2F is lower right hand X-coordinate
  491.                          EY2F is lower right hand Y-coordinate
  492.                          EForegrndF is the text foreground color
  493.                          EBackgrndF is the background textcolor
  494.                          EFrameF is an integer value (1..5) wich designates 
  495.                                  the the style of frame you desire on
  496.                                  your window.
  497.                                   
  498.          EFrameF types are as follows:
  499.            
  500.                          1  A single line surrounding the window.
  501.                          2  A double line surrounding the window.
  502.                          3  Two horizontal double lines and two vertical 
  503.                             single lines surrounding the window.
  504.                          4  A solid frame the thickness of one 
  505.                             cursor surrounding the window.
  506.                          5  No frame.
  507.  
  508.          Example call:
  509.           
  510.                            Add_Window(5,5,50,20,1,2,2);
  511.                  
  512.               This call in particular will create a window with the upper 
  513.          left  hand  corner of the frame positioned at the location (5,5) 
  514.          and the lower right hand corner of the frame (not the window) at 
  515.          the location (50,20).  The color  of  the  frame  will  be  blue 
  516.          (textcolor  1)  against  a  background  of  green (textcolor 2).  
  517.          Refer to the PC-Dos  2.0  Addendum  at  the  end  of  the  Turbo 
  518.          Referance Manual or the last page of this manual for color value 
  519.          constants.  It  will  be  surrounded by frame type #2 which is a 
  520.          double lined frame.  Up to eight windows can be on the screen at 
  521.          one time unless the source code  is  modified  to  handle  more.  
  522.          This  is  explained  in the section on source modification.  Try 
  523.          this little sample program to test the Add_window procedure: 
  524.           
  525.                         {$I VAR.INC}
  526.                         {$I WINDMNGR.INC}
  527.           
  528.                         Begin
  529.                              Initialize;
  530.                              Add_window(5,5,50,20,1,2,2);
  531.                              repeat until keypressed
  532.                         end.
  533.  
  534.               When  using  the Add_Window procedure keep in mind that the 
  535.          coordinates you give will be the coordinates of the frame of the 
  536.          window.  The actual window will be (X1+1,Y1+1), (X2-1,Y2-1).  
  537.  
  538.  
  539.  
  540.  
  541.  
  542. THE WINDOW MANAGER                                                     PAGE   9
  543.  
  544.  
  545.           
  546.          E--Grow_Window--F Procedure
  547.          E--___________--F          
  548.           
  549.               This procedure is essentially the same  as  the  Add_Window 
  550.          procedure  in all respects except that the window will start out 
  551.          as a small cube in the middle of the screen and appear  to  grow 
  552.          to the size of the specified coordinates.  Wonderful huh?  
  553.           
  554.          Syntax:
  555.           
  556.          Grow_Window(<EX1F>,<EY1F>,<EX2F>,<EY2F>,<EForegrndF>,<EBackgrndF>,<EFrameF>);
  557.  
  558.               All  parameters  for the Grow_Window procedure are the same 
  559.          as in the Add_Window procedure.  
  560.  
  561.          Example call:
  562.           
  563.          Grow_Window(10,7,40,18,2,0,2);
  564.  
  565.               Try the same example program as in the Add_Window procedure 
  566.          description  only  substitute  the  Add_Window  call  with   the 
  567.          Grow_window call from above.  
  568.  
  569.          --ERemoveF-- Procedure
  570.          --E______F--          
  571.  
  572.               Removes a specified  number  of  windows  from  the  screen 
  573.          without destroying any of the underlying information.  
  574.  
  575.          Syntax:
  576.  
  577.                          Remove(<E# of windows to removeF>);
  578.   
  579.          Where:
  580.                 
  581.                          E# of windows to removeF is an integer number 
  582.                             between 1 and the number of screens that  
  583.                             are active.
  584.  
  585.          Example call:
  586.  
  587.                                     Remove(1);
  588.  
  589.              This  example  call  will  remove the top most active window 
  590.          from the screen and activate the  underlying  window.  When  the 
  591.          underlying  window  is  reactivated,  the  cursor  is positioned 
  592.          exactly where it was when you left off.  For example,  I can add 
  593.          a  window and write 'Hello' inside the window.  Whenever I add a 
  594.          new window and then remove it,  my cursor will be  automatically 
  595.          positioned  directly  after  'o'  in  'Hello'.  Here is a little 
  596.          sample program: 
  597.  
  598.                                 Program Remove_test;
  599.  
  600.                                 {$I VAR.INC}
  601.                                 {$I WINDMNGR.INC};
  602.                                 {$I GROWWIN.INC}
  603.  
  604. THE WINDOW MANAGER                                                     PAGE  10
  605.  
  606.  
  607.           
  608.                                 Var Ch: CHar;
  609.  
  610.                                 Begin
  611.                                      Initialize;
  612.                                      Add_window(5,5,50,15,1,2,3);
  613.                                      Grow_Window(30,10,60,23,11,0,2);
  614.                                      Repeat until keypressed;
  615.                                      Read(kbd, ch);
  616.                                      Remove(1);
  617.                                      Repeat until keypressed;
  618.                                      Read(kbd,ch);
  619.                                      Remove(1)
  620.                                  end.
  621.           
  622.               Whenever using the Remove procedure,  keep in mind that the 
  623.          number of windows to remove cannot be higher than the number  of 
  624.          windows that are active.  
  625.  
  626.          E--Color_Window--F Procedure
  627.          E--____________--F          
  628.  
  629.               With this command,  you may  change  the  color  attributes 
  630.          (foreground  & background colors) of the currently active window 
  631.          (the one on top).  
  632.  
  633.          Syntax:
  634.           
  635.                        Color_Window(<EForegrndF>,<EBackgrndF>);
  636.          
  637.          Where:
  638.          
  639.                        EForegrndF is the new foreground color (or text 
  640.                                   color)  to be used.
  641.  
  642.                        EBackgrndF is the new background color to be used.
  643.  
  644.          Example call:
  645.  
  646.                                 Color_Window(12,7);
  647.                             
  648.               This call will  change  the  attributes  of  the  currently 
  649.          active  window to a foreground color of red (textcolor 12) and a 
  650.          background color of light grey (textcolor 7).  Here is  a  small 
  651.          sample  program  that  will  create a window and then change the 
  652.          its color after a key is pressed: 
  653.           
  654.                             Program Change_Window_Color;
  655.  
  656.                             {$I VAR.INC}
  657.                             {$I WINDMNGR.INC}
  658.  
  659.                             Var Ch: Char;
  660.           
  661.                             Begin
  662.                                  Initialize;
  663.                                  Add_Window(20,10,60,20,12,0,2);
  664.  
  665. THE WINDOW MANAGER                                                     PAGE  11
  666.  
  667.  
  668.                                  Repeat until keypressed;
  669.                                  Read(kbd,ch);
  670.                                  Color_Window(1,7);
  671.                                  Repeat until keypressed;
  672.                                  Read(kbd,ch);
  673.                                  Remove(1)
  674.                             end.
  675.  
  676.          E--Window_Title--F Procedure
  677.          E--____________--F          
  678.  
  679.              Adds a title to the currently activated window.  The  title, 
  680.          providing  you are not using frame type #4 or #5,  is surrounded 
  681.          by brackets ([ & ]).  
  682.  
  683.          Syntax:
  684.  
  685.                   Window_Title('<ETitleF>',<EColorF>);
  686.  
  687.          Where:
  688.                         
  689.                         ETitleF is a string of characters which should be 
  690.                                 less than the width of the frame in
  691.                                 frame.  The title must be enclosed in
  692.                                 single quotes.
  693.  
  694.                         EColorF is the combination foreground-background 
  695.                                 (text color) of the title to be displayed.
  696.                                 This value is determined by the formula:
  697.  
  698.                                EColorF = Foreground + (background * 16)
  699.           
  700.                                 Example: Blue colors on a green 
  701.                                 background would be (1+(2*16)) where 1 is
  702.                                 the value for the color blue and 2 is the
  703.                                 value for the color green.
  704.          Example call:
  705.  
  706.                       Window_Title('TEST TITLE',(12+128)+(7*16)); 
  707.  
  708.               This call will place the title 'TEST TITLE' at the top left 
  709.          hand  corner  of  the  active  window.  It  will be flashing red 
  710.          characters (12+128) against  a  light  gray  background  (7*16).  
  711.          Whenever  I  add  128  to  any of the basic colors,  they become 
  712.          flashing characters.  Once again, a sample program: 
  713.  
  714.                            Program Title_Test;
  715.  
  716.                            {$I VAR.INC}
  717.                            {$I WINDMNGR.INC}
  718.                      
  719.                            Begin
  720.                                 Add_Window(3,3,60,10,1,7,3);
  721.                                 Window_Title('TEST TITLE',(128+12)+(7*16))
  722.                              end.
  723.  
  724.  
  725.  
  726. THE WINDOW MANAGER                                                     PAGE  12
  727.  
  728.  
  729.          
  730.          E--Select_Window--F Procedure
  731.          E--_____________--F          
  732.  
  733.               If you have defined an include file  with  EWINDODEF.COMF  or 
  734.          have  calculated  the  values  yourself,  then  you  may use the 
  735.          Select_Window  procedure.   (See  section  on  WINDODEF.COM  for 
  736.          information on defining windows to be used in your program).  
  737.  
  738.          Syntax:
  739.          
  740.                           Select_Window(<EWindow numberF>);              
  741.  
  742.          Where:
  743.                          EWindow numberF is the number of the window 
  744.                                          to activate.
  745.  
  746.          Example Call:
  747.  
  748.                           Select_Window(1);
  749.  
  750.               This little call activates a pre-defined window number one.
  751.  
  752.                            -A Little on defining windows-
  753.  
  754.               Windows may be defined in an array and implemented into  an 
  755.          include  file  as constants easily making it possible to lay out 
  756.          your windows before implementing them  in  your  program.  There 
  757.          are essentially two possible ways of doing this.  You can either 
  758.          figure  them  out  for  yourself or use the EWINDODEF.COMF program 
  759.          included in this package  which  will  do  -everything-  described 
  760.          below.  The  operation  of  the windodef program is explained in 
  761.          the Windodef section.  I will explain how to do it yourself (the 
  762.          harder way),  but I suggest you skip this section and  read  the 
  763.          -Using EWINDODEF.COMF- section.  
  764.           
  765.               Ok,  Here goes..  The values for windows can be pre-defined 
  766.          and added to your programs.  The way to do this is to figure out 
  767.          where you want your windows to appear on the  screen  and  enter 
  768.          them  into  constants  and have the procedure create the windows 
  769.          for you.  First, write down the x,y coordinates, attributes, and 
  770.          titles for your windows.  The next step will be to put them into 
  771.          2  constants.  The  syntax  for  the  Include  procedure  is  as 
  772.          follows.  
  773.  
  774.          PROCEDURE SELECT_WINDOW(WIN_NUM: INTEGER);
  775.          
  776.          CONST WINDOWS: ARRAY[1..9,1..8] OF INTEGER =
  777.          (<X1>,<Y1>,<X2>,<Y2>,<Foregrnd>,<backgrnd>,<Frame>,
  778.          <Title Color>,     {Window 1}
  779.          ("  "         "           "       "  ), {Window 8}
  780.          (0,0,0,0,0,0,0,0)); {end flag,must be present}
  781.  
  782.          CONST TITLE: ARRAY[1..9] OF STRING[80] =
  783.          ('Title #1',....,'Title #8','');
  784.  
  785.          BEGIN
  786.  
  787. THE WINDOW MANAGER                                                     PAGE  13
  788.  
  789.  
  790.               IF (WINDOW[WIN_NUM,7] > 0) AND (WIN_NUM > STACK_TOP) THEN
  791.                      BEGIN
  792.                           ADD_WINDOW(WINDOWS[WIN_NUM,1],
  793.                                      WINDOWS[WIN_NUM,2],
  794.                                      WINDOWS[WIN_NUM,3],
  795.                                      WINDOWS[WIN_NUM,4],
  796.                                      WINDOWS[WIN_NUM,5],
  797.                                      WINDOWS[WIN_NUM,6],
  798.                                      WINDOWS[WIN_NUM,7);
  799.                           IF TITLE[WIN_NUM] <> '' THEN
  800.                                       WINDOW_TITLE(TITLE[WIN_NUM],
  801.                                                    WINDOWS[WIN_NUM,8]);
  802.                      END
  803.               ELSE
  804.                      IF WINDOWS[WIN_NUM,4] > 0 THEN
  805.                           BEGIN
  806.                                IMIG[LAST_WINDOW_NUM].W1:=WHEREX;
  807.                                IMIG[LAST_WINDOW_NUM].W2:=WHEREY;
  808.                                WINDOW(1,1,80,25);
  809.                                GOTOXY(1,1);
  810.                                WITH IMIG[WIN_NUM] DO
  811.                                      BEGIN
  812.                                           WINDOW(X1,Y1,X2,Y2);
  813.                                           TEXTCOLOR(C1+(B1*16))
  814.                                      END;
  815.                                GOTOXY(1,1);
  816.                                GOTOXY(IMIG[WIN_NUM].W1,IMIG[WIN_NUM].W2);
  817.                                LAST_WINDOW_NUM:=WIN_NUM
  818.                           END
  819.          END;
  820.          
  821.          (See EDEMODEFS.INCF to see the real procedure)
  822.          That's it..  Although,  it's much easier to use the EWINDODEF.COMF 
  823.          program.  
  824.          
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847. THE WINDOW MANAGER                                                     PAGE  14
  848.  
  849.  
  850.          
  851.                            E-Other Functions & ProceduresF-
  852.  
  853.               Along  with  the  main procedures described in the previous 
  854.          section,  there are also some smaller functions  and  procedures 
  855.          within  the window manager routines which may be accessed by the 
  856.          user.  In this section,  we will discuss these and some of their 
  857.          applications.  
  858.  
  859.          EActiveF function
  860.  
  861.               This function returns the number of windows that are pushed 
  862.          on the stack (on the screen).  This number will be between  1 
  863.          and 8 unless the source code is modified to handle more windows.  
  864.          See the section on modifying the source code.  
  865.  
  866.          Syntax:
  867.  
  868.                                <EVariableF> := Active;
  869.  
  870.          Where:
  871.               
  872.                                 EVariableF is an integer variable;        
  873.  
  874.          Example call:
  875.  
  876.                                Windows_Up := Active;
  877.  
  878.  
  879.               This   example  call  will  assign  the  declared  variable 
  880.          Windows_Up to the number of windows that are on  the  screen.  A 
  881.          use  for  this  may be to  clear  all the active windows off the 
  882.          screen like this: 
  883.  
  884.                                   Remove(Active);
  885.  
  886.          E--Set_Page--F Procedure
  887.          E--________--F          
  888.  
  889.              Used to set the current video page.  That is,  the  area  in 
  890.          video  RAM  wich  is displayed on the screen.  There are four 4K 
  891.          pages in color (Pages 0 though 3) mode and  eight  2K  pages  in 
  892.          Monochrome mode (Pages 0 through 7).  
  893.  
  894.          Syntax:
  895.  
  896.                                  Set_Page(<EByteF>);
  897.  
  898.          Where:
  899.  
  900.                                  EByteF is a byte value within the range 
  901.                                         $00 though $03 for color and $00
  902.                                         through $07 in mono. 
  903.  
  904.           Example call:
  905.  
  906.                                   Set_Page($01);
  907.  
  908. THE WINDOW MANAGER                                                     PAGE  15
  909.  
  910.  
  911.  
  912.              Sets  the current video page to page 1 allowing you to write 
  913.          to page 0 with regular writeln  and  write  routines.  Try  this 
  914.          small example program: 
  915.  
  916.                               Program Switch_Page;
  917.  
  918.                               {$I VAR.INC}
  919.                               {$I WINDMNGR.INC}
  920.  
  921.                               Var i: Integer;
  922.  
  923.                               Begin
  924.                                    ClrScr;
  925.                                    Set_Page($01);
  926.                                    For i:=1 to 300 do write(' Hello ');
  927.                                    Set_Page($00)
  928.                               end.
  929.  
  930.               This little program will clear the screen,  switch to video 
  931.          page #1, which will remain cleared, fill page 0 with Hello's and 
  932.          then switch back to page 0 creating the illusion of speed.  
  933.  
  934.               If  you  are adventurous you can play around with the other 
  935.          various procedures within the window  manager  routines.  Within 
  936.          the source are routines to write directly to screen memory, turn 
  937.          off the crt, bypass the windows and write directly to screen 
  938.          memory, draw boxes, and various other things...
  939.            
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968. THE WINDOW MANAGER                                                     PAGE  16
  969.  
  970.  
  971.          
  972.                        E-Using WINDODEF.COM to define windowsF-
  973.  
  974.  
  975.              There  is  also  a  program included with the package called 
  976.          EWINDODEF.COMF.  This program may be used  to  pre-define  windows 
  977.          for  implementing  into  your  own  Turbo  Pascal programs.  The 
  978.          purpose of this program is to write a E$IFnclude file.  To do this 
  979.          just invoke the program by typing its name at the Ms-dos prompt.  
  980.          A menu will be displayed with EWINDODEFF  functions  numbered  one 
  981.          through five.  We will discuss each of these.  
  982.  
  983.          -Option 1:- Edit/Configure window file
  984.  
  985.               When  this option is selected the screen is cleared and you 
  986.          are asked which window number to define.  At this point enter an 
  987.          integer  value  in between one and eight.  A small 5 by 5 window 
  988.          is placed in the upper left hand corner of the screen.  Use  the 
  989.          cursor  keys  to  move  this  box around.  An explanation of the 
  990.          function keys is printed at the top of the  screen.  The  window 
  991.          can be moved,  expanded,  titled, re-framed, and colored.  After 
  992.          you have the window adjusted to your desires,  just hit function 
  993.          key  ten  to return to the main menu.  Now you may select one of 
  994.          the other options from the menu or define another window.  
  995.           
  996.          -Option 2:- Save definitions to disk file
  997.          
  998.               After you have completed  defining  all  of  your  windows, 
  999.          select  this  option  to save the files to an include file which 
  1000.          you may easily incorporate into  your  own  Turbo  program.  The 
  1001.          file  is  saved to disk under the name EDEFS.INCF.  After the file 
  1002.          is saved you may rename it to whatever you want  at  dos  level.  
  1003.          To use your definitions in a Turbo program,  just make the first 
  1004.          three lines of your program: 
  1005.           
  1006.                               {$I VAR.INC}
  1007.                               {$I WINDMNGR.INC}
  1008.                               optional {$I GROWWIN.INC}
  1009.                               {$I DEFS.INC}
  1010.  
  1011.               You may now use the select_window  procedure  described  in 
  1012.          the  previous  section.   See  the  EDEMODEFS.INCF  file  and  the 
  1013.          EDEFDEMO.*F programs.  
  1014.  
  1015.          -Option 3:- Clear defined window
  1016.  
  1017.               This option may be selected to clear a window that you have 
  1018.          defined.  This is a precaution in case you mess up a window  and 
  1019.          have  all the others defined (or some of the windows).  You will 
  1020.          be prompted with  "Clear  window  number  #:".  Just  enter  the 
  1021.          number  of  the  window  you  wish to be cleared and that window 
  1022.          number will be completely reset.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028. THE WINDOW MANAGER                                                     PAGE  17
  1029.  
  1030.  
  1031.           
  1032.          -Option 4:- Display defined windows simultaneously
  1033.  
  1034.               This option may be selected  to  display  all  your  defined 
  1035.          windows  on the screen at once so you can see what they look 
  1036.          like all together.  
  1037.  
  1038.          -Option 5:- Exit to system
  1039.          
  1040.               This  option  is  pretty  much  self  explanatory.  Just -be -
  1041.          -certain- to save your windows before exiting.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088. THE WINDOW MANAGER                                                     PAGE  18
  1089.  
  1090.  
  1091.           
  1092.            
  1093.                         E-The Window Manager under Monochrome-F
  1094.            
  1095.  
  1096.               To the best of my knowledge,  this program will  work  fine 
  1097.          under  IBM  Monochrome  Graphics.  All  that  need be done is to 
  1098.          change the statement EScreen_Seg = $B800F in the EVAR.INCF  file  to 
  1099.          EScreen_Seg = $B000F.  That's all,  and be sure to watch what text 
  1100.          colors you use.  
  1101.               
  1102.          
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148. THE WINDOW MANAGER                                                     PAGE  19
  1149.  
  1150.  
  1151.          
  1152.                              E-Modifying the source codeF-
  1153.  
  1154.  
  1155.               If you would like to have more than eight  windows  on  the 
  1156.          screen at once, this is possible by modifying the source code of 
  1157.          the  EVAR.INCF  file  to  handle this.  There is a constant called 
  1158.          -MAX_SCREENS- that may be changed to either a higher number  or  a 
  1159.          lower  number.  If  it  is  changed  to  a  higher number,  each 
  1160.          additional window will require 4K of memory.  Be sure  you  have 
  1161.          enough  memory  to suit the adjustment.  Memory can be conserved 
  1162.          by lowering the number of possible windows.  This will  save  4K 
  1163.          for each additional window removed.  
  1164.              The  constant  -DATA_ADDRESS-  points  to  page  one  in video 
  1165.          memory.  By incrementing this constant, the windows can be drawn 
  1166.          into any portion of video memory.  
  1167.              You  can  peek  through the source code and remove un-needed 
  1168.          procedures whenever you are writing a program.  This  will  also 
  1169.          save  on memory. 
  1170.              Please DO NOT  distribute  any  modofied  versions  of  this 
  1171.          program.  I  wouldn't  like  people calling me and saying,  "Hey 
  1172.          Jim,  this and this doesn't work!".  Oh well,  thanks for  using 
  1173.          the program and I really hope you enjoy it.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208. THE WINDOW MANAGER                                                     PAGE  20
  1209.  
  1210.  
  1211.          
  1212.                               E-Quick Reference SectionF-
  1213.  
  1214.  
  1215.          -Basic layout of your program should be as follows.-
  1216.  
  1217.          Program <program name>;
  1218.  
  1219.          {$I VAR.INC}
  1220.          {$I WINDMNGR.INC}
  1221.          <optional {$I GROWWIN.INC}>
  1222.          <optional {$I DEFS.INC}>  <== may be renamed
  1223.  
  1224.          Your procedures and functions go here
  1225.  
  1226.          begin {Main program body}
  1227.                 Inititialize;
  1228.                 more code...
  1229.                  -
  1230.                  -
  1231.                  - 
  1232.          end. {end main}
  1233.  
  1234.          -Procedures:-
  1235.  
  1236.          Initialize;    {Initializes stack, must be first line}
  1237.  
  1238.          Add_Window(<x1>,<y1>,<x2>,<y2>,<Foregrnd>,<Backgrnd>,<Frame>);
  1239.  
  1240.                         {Adds a window of specified size}
  1241.  
  1242.          Grow_window(<x1>,<y1>,<x2>,<y2>,<Foregrnd>,<Backgrnd>,<Frame>);
  1243.  
  1244.                         {Same as add_window only window appears to grow}
  1245.          
  1246.          Remove<<# to remove>);  {removes a specified # of windows}
  1247.  
  1248.          Color_Window(<Foregrnd>,<Backgrnd>); 
  1249.  
  1250.                         {Change color attributes of window}
  1251.  
  1252.          Window_Title('<Title>',<Color>);
  1253.  
  1254.                         {Adds a title to your window, color is determined
  1255.                          by the formula color = forgrnd+(backgrnd * 16)}
  1256.  
  1257.          Select_Window(<Window #>);
  1258.  
  1259.                         {Selects a predefined window, if window is 
  1260.                          already up, then it is just reactivated}
  1261.  
  1262.          Active;   {Assign the number of active windows to itself, 
  1263.                     Function}
  1264.  
  1265.          Set_Page(<byte>); {sets active video page}
  1266.  
  1267.  
  1268. THE WINDOW MANAGER                                                     PAGE  21
  1269.  
  1270.  
  1271.          
  1272.          -Text color values-
  1273.  
  1274.                 0 black                 8  gray
  1275.                 1 blue                  9  light blue
  1276.                 2 green                 10 light green
  1277.                 3 cyan                  11 light cyan
  1278.                 4 red                   12 light red
  1279.                 5 magenta               13 light magenta
  1280.                 6 brown                 14 yellow
  1281.                 7 white                 15 high intensity white
  1282.  
  1283.          Note: Adding 128 to any color makes it a blinking color.
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328. THE WINDOW MANAGER                                                     PAGE  22
  1329.  
  1330.  
  1331.          
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.          Hello.....
  1338.  
  1339.                 I am a student at The Pennsylvania State  University  and 
  1340.          am  in  need  of  some  extra  work.  If  you  need  any program 
  1341.          conversions, custom programming, etc..  Please give me a call or 
  1342.          write me.  I work for  cheap!  I  program  in  Pascal,  Fortran, 
  1343.          PL/1,  PL/C,  and  Basic.  By  June  85 I shall also know PDP-11 
  1344.          Assembler, 8088 Assembler, and IBM SYS/370 Assembler.  So if you 
  1345.          have some work, give a ring.  
  1346.  
  1347.                                         Thanks,
  1348.  
  1349.                                         Jim Everingham
  1350.  
  1351.  
  1352.  
  1353.  
  1354.                              Jim Everingham
  1355.                              318 East Sheridan Avenue
  1356.                              DuBois Pa., 15801
  1357.                              814-238-9655 or
  1358.                              814-371-1355 after June 85
  1359.                              CIS: 75116,433
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388. THE WINDOW MANAGER                                                     PAGE  23
  1389.