 ------------------------------------------------------------------------------








			Welcome to Graphics Programming II

				  The Sequel











 last year..
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------






			    Simple objectives


		    Re-create the looks of Microsoft Windows












  (k)
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------










				      in 16k











 extending
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------








			  Extending the GUI16k system

			      Window dressings











 giving away
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------









			 Giving away the full source code












 revisited
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------










			    The Basics Revisited











 concept
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------








			  The LUI, DUI and GUI concept.













  frames and things
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------





			       Foundation

		 Frames / Windows    (movable overlapping boxes)

		 Mouse / Click Areas (responsive mouse areas)

		 Event Supervisor    (the GUI Engine)










 ifs
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



   ImageStack = RECORD
	nxtptr	       : ImageStkPtr;	{forward chain of Frames}
	lstptr	       : ImageStkPtr;	{backward chain of Frames}
	x,y,x1,y1      : Word;		{frame coordinates}
	redrawcallproc : callproc;
	MsPtr	       : MsClickPtr;	{ms chain for mouse click areas}
		END;



      function OpenFrame(x,y,x1,y1,address of redraw function) : handle;
      Procedure CloseFrame(handle);
      procedure RotateTop(ifs:imagestkptr);







 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------




    procedure MsWindowredraw(ifs:ImageStkPtr; ms: MsClickPtr);
    {$F-}
	begin
	   .
	   {draw ms window clone}
	   .
	end;





    ifs := OpenFrame(x,y,x1,y1,MSWindowRedraw);






 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			    Rodent Interfacing


     MSClickStk = RECORD
	  nextmsclick	 : MsClickPtr;	  {mouse click chains}
	  x,y,x1,y1	 : integer;	  {mouse x,y,x1,y1 region}
	  entrycallproc  : callproc;	  {normal mouse click call event}
		  END;












 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



		       Use link list to associate

		    Frame1 - Ms1 - Ms2 - Ms3
		      |
		    Frame2 - Ms1 - Ms2
		      |
		    Frame3 - Ms1 - Ms2 - Ms3 - Ms4
		      |
		    Frame4 - Ms1











 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			     The Event Paradigm


			if the phone rings, answer it.

			   event is phone ring...

		       event handler is answer phone.












 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			    The Game of Monopoly




	    Events are broken down into object like programming.

			 simple 1 to 1 relationships












 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------


			     The EventManager



			   repeat
			       if buttons<>0
				  findframe
				     find mouse click area
					call event

			   until the COWS come home










 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------








				 foundation

			     requires only 16k

			   5k or less in assembler










 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------








				    Bad News













 The next level of GUIism
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------









		     Creating dialogues with the Event Paradigm

			 is like solving a 3d chinese puzzle











 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------









		     Solution is to glue some of the pieces together













 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------








			    Creating a string input














 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			(Basic Tools) Keeping track of Data.

				User Data Area



		     allows us to add data structures to a frame


	     SetUserDataArea(fs,Userkey,Var Userdata,terminatedataproc);
	     GetUserDataArea(fs,Userkey,Var Userdata);









 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



       procedure FreeStrEdit(fs:ImageStkPtr; Userkey:word; Var DataArea);
	  var SEP : septr absolute DataArea;
	  begin
	     freemem(sep,sizeof(sep^));
	  end;





       var se : septr;
	  begin
	     getmem(se,sizeof(se^));
	     SetUserDataArea(fs,$7000,se,FreeStrEdit)






 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			(Basic Tools) Keyboard Events



	      defineLocalKeyClickArea(fs,ms,Keycode,EntryCallProc);




	      to allow events to be called from the supervisor when
	      a key is pressed on the keyboard.









 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			  (Basic Tools) Tablinks



		       Tabkeys circular linked list

	   addtablinks(ifs,ms,highlightproc,dehighlightproc,activateproc);

	   activatetablinks(ifs,tabnum);

	   settablink(ifs,tabnum);	       set tab position at tabnum

	   ct:=getactivetabnum(ifs);	       returns the active tab number.







 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			  (Basic Tools) Timer Events



	      to allow events to be called from the supervisor when
	      a certain duration has passed, ie. a blinking text cursor














 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



			 (Basic Tools) Pending Events



	      to allow pending events to be called from the supervisor
	      when an event requires an action before the next event is
	      called. ie. turning off the blinking text cursor.













 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------

	     1)  definestreditevent()  a) creates user record
	     2)  setstredit()	       a) sets associated user record active
				       b) define local keypress events
				       c) sets timer event for blinking cursor
      Supervisor		       d) attaches pending event
  							    
    pending events  conditional string edit de-activation	    
  	  		 a) detaches keypress events		    
  	  		 b) stops text cursor blinks.		    
  	  							    
    keypress event a) retrieves string edit record  user record
  	  		 b) accepts keyboard char
  	  		 c) process and echos to screen
  	  		 d) updates blinking cursor position
  	  
    mouse events a) finds and set string record active
  	  		 b) define local keypress events
  	  		 c) finds and sets cursor position relative to mouse
  	  		 d) sets timer event for blinking cursor
  	  
    timer events  text cursor blink
  
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------


			 activation entry points

	 1) click on string input area to set text cursor at mouse position.
	 2) tab to the string input area
	 3) click on the label




		      de-activation entry points

	    1) user clicks outside of the string input area
	    2) user clicks on another string input area
	    3) user presses a defined function key ie. alt-menu keys

		       handled by pending event





 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------

	    1) definestreditevent()
	    2) definemouseclickarea() on label
	    3) addtablinks()

Supervisor
	
  pending events  conditional de-activation of string edit.
	
	
  keypress event
     callproc  alphanumeric calls string edit
	       tab	    calls dehighlight - none
				    calls highlight   - setstredit
	       enter	    acts as tab       - settablink(ifs,ct+1)
	
  mouse events
	       on string (position cursors)   - formevent -> settablink
	       on label  setstredit()	      - formevent -> settablink
	
  timer events  text cursor blink


 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------







				  Heady stuff!!















 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------











			 Adding glue by standardization











 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



   ifsaddinputline(ifs,x,y,maxlen:word; title:string; var stringptr:string)

   will:

   a) display the label
   b) define a mouse click area around the label
   c) define the string edit area
   d) add the tab key

   Ŀ
    Address : 						
   








 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------



				(Basic Tools)

				User data Areas
				Keyboard Events
				Timer Events
				Pending Events
				Tablinks
				Event driven User input

			  just to add an input string function.










 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------


				  Window Dressings






			    How heavy are the curtains?













 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------






			  The bulk of Microsoft windows are the
				 interdependant links.

				CUA, SAA Standards

				   Peer Pressure










 Take a guess...
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------







				     30k!


				 not too bad!!












 ------------------------------------------------------------------------------
