                          .       .
                         / `.   .' \
                 .---.  <    > <    >  .---.
                 |    \  \ - ~ ~ - /  /    |
                  ~-..-~             ~-..-~
              \~~~\.'                    `./~~~/
    .-~~^-.    \__/         PGE            \__/
  .'  O    \     /               /       \  \
 (_____,    `._.'               |         }  \/~~~/
  `----.          /       }     |        /    \__/
        `-.      |       /      |       /      `. ,~~|
            ~-.__|      /_ - ~ ^|      /- _      `..-'   :  :
                 |     /        |     /     ~-.     `-. _||_||_
                .|_____|       .|_____|         ~ - . _ _ _ _ _>
		
             The Pascal Graphical Environment
Contents
	1. What is PGE
	2. Why Does it exist
	3. Who did i copy
	4. How do i use it
	5. Can I Change It
	6. Compileing
	7. Module List
	8. Licence
	9. Credits

1. What Is PGE?
Well PGE is a GUI widgit set that provides a GUI for developing Graphical aplications for
dos. Note! PGE IS NOT A GUI. PGE provides extreamly simple control of items so as to crea
te an easy method of programing graphical apps but still maintain simplisity and control.
What i mean is, the programmer has full control of the events because he defines them.

2. Why Does It Exist?
PGE exists because like GUI R3 i am sick to death of seeing these masive crap GUI's with
sad window control and because they are so complex and badly programed one is hard pressed
to fix any problems. Also why would any one try to sell a GUI for dos, more so why would
anybody buy a GUI for dos when windows costs nothing and linux is free.
anyway, i am giving all my reserch and code (including comments) away for free.

3. Who did i copy?
All algorithms are my design, some programs were used to get ideas about how to do stuff. 
I did take the CDRom controler from somewhere, i forgot where, sorry to the author :-(
I also got the mouse controler from somewhere, it is a good mouse controller, a pitty that i cant find
a descent 256color controler. 
The folowing programs were used as inspiration
Views - Somewhere on simtell, lots of object colections stuff.
GUI R3 - Got some ideas but alot of graphic stuff came from there.
Talisin - C++ but good window moving control.
SKY Os  - Has an interesting GUI, some calulatios taken from there.

Thanks to PapaRoach and The Offspring for soothing my mind while i code :)

4. How do i use it.
Well thats up to you, there are a good few examples the best i think are
Demo.Pas     | Demonstrates All of the controls
Demo2.pas    | Demonstrates an animation in a window
Calc.Pas     | Crapy Calculator, if anybody an get this to work in real values pleas tell me
CDPlayer.Pas | A Cool CD Player
Popwin.Pas   | Demonstrates Drawing of a window during runtime.
editor.pas   | A simpile PopUp and edit box implementation.

Here is a template of how to use it
program MyProgram;

uses crt,{$I pge.inc}

var
   MyGUI    :TGui;
   MyScreen :TScreen;

   MyWindow:TWin;
   MyButton:TButton;

   Done:boolean; {Loop Control}

procedure MyEventLoop;
begin
      while Done=false do
      begin

           if keypressed=true then if readkey=#27 then Done=true; {Exit if User Preses Escape Key}
	   if MyWindow.Closed=true then done=true; {exit if close button was pressed}
           if MyButton.pushed=true then
           begin
		{INSERT CODE HERE}
           end;

	   {INSERT EVENTS HERE}

           if MyWindow.Moved=true then         {If Window Was Moved Then}
                MyButton.ParentMove(MyWindow); {Redraw Button In Parent Window}

      end;
end;
begin

      MyScreen.Init('.\',0,0); {INITIALISE SCREEN}

     {TWIN.MAKE ( x, y , length, Height, TitleBarCaption, MinX size, MinY Size, Title Bar Sprite}
	 
      MyWindow.Make(20,20,150,100,' Sample Window ',150,100,blue);

      MyButton.make(30,50,70,20,'Button1',0,Window1);

      MyWindow.draw;
      MyButton.draw;
      
       MyEventLoop;

      DeskTop.VideoOff;
end.


5. Can I change it?
Of course, but read section 6 first. I would recomend not adding to the PGE.PAS file
because it is geting bloated but you can add a control like EditBox.Pas was added or
you can add it to XPGE. Incase you dont know how here is a template.

unit MyControl;

interface

uses crt,graph,pge,fx,mousei,video; { <- Most Common Things To Include }

const
     {INSERT CONSTANTS HERE}

type
    PControl=^TControl;
    TControl=Object(TWin)
       x,y,l,h:integer;
       ox,oy  :integer;
	{INSERT VARIABLES HERE}

       Constructor Make (rx,ry,rl,rh,rFont:Integer; rBlankOut:Boolean; parent:TWin);
       Procedure  Draw;                         Virtual;
       Procedure  ParentMove(Parent:TWin);      Virtual;
	
	{INSERT METHODS HERE}

       Destructor  Destroy;
    end;

Implementation

{START OF CODE}

  Constructor TControl.Make;
     Begin
          ox:=rx;
          oy:=ry;
          x:=rx+Parent.w_x;
          y:=ry+Parent.w_y;
          l:=rl;
          h:=rh;
	  { INSERT CODE HERE }		             
     end;

  Procedure  TControl.Draw;
     Begin
          Mouse_Cursor(false);

	  { INSERT CODE HERE }		             

          Mouse_Cursor(True);
     end;

  Procedure  TControl.ParentMove;
     Begin
          x:=ox+Parent.w_x;
          y:=oy+Parent.w_y;
          Self.Draw;
     end;

  Destructor TControl.Destroy;
     Begin
	  { INSERT CODE HERE }
     end;

{END OF CODE}

end.

and if you fix something please tell me and send me the code.

6. Compiling
To use PGE with your program, place the pge directory somewhere and put that directory in to 
your units path in Turbo Pascal (see below). Then include the file "pge.inc" in the folowing way

uses myunits, {$I pge.inc}

And there you go.

I have included a usefull script called build.bat. To use it you must edit the file
and change the path to that of your compiler
ie.
   set TP=C:\tp
changes to
   set TP=C:\where_pascal_is
Then just run build and it will compile all the examples and modules. You can also
jut compile straight from Turbo Pascal.

To compile in Turbo Pascal, you must go into the directorys setup
thats Options->Directories.
Under units add .\pge and the directiory to your TP7 units. rember to separate multiple
directories with semi colons.
eg. My units reads
C:\TP\UNITS; .\PGE
This is nesisary as i have separated the units from the programs and you need to tell it
to look for the PGE units in the PGE folder the ".\" tells it that the directory is off
the current path.

7. Module List
PGE.PAS		-  Main Module
POPUP.PAS	-  Popup Menu Module
VIDEO.PAS	-  Video Module
FX.PAS		-  Special FX Module
EDITBOX.PAS	-  Edit box Module
BITMAP.PAS	-  Bitmap Suport Module
LISTBOX.PAS	-  List Box Module
KEYDEF.PAS	-  Key Map
MISC.PAS	-  Miscelaneous Tools
MATH.PAS	-  Math Module
XGRAPH.PAS	-  Graphics extentions
DINO.PAS	-  Dino the PGE Dinosour
XCRT.PAS	-  CRT extentions
CDAUDIO.PAS	-  CD Player Control Module
MOUSE.PAS	-  Mouse Driver
MOUSEI.PAS	-  Mouse Driver Interface
INI.PAS		-  .INI file Module
DIALOG.PAS	-  Dialoge Module
IO.PAS		-  File IO Module


8. Licence
    The Pascal Graphical Environment
    Copyright (C) 2000 Colin Alston

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


Any way, Get Programing With PGE!

Send comments To
or diskbox@yifan.net

	



