*** console.c	Mon Aug  2 18:17:22 1993
--- myconsole16.c	Sat Apr  9 12:07:38 1994
***************
*** 1,10 ****
  
  /*
!  *  console.c
   *
   *  Copyright (c) 1991 Symantec Corporation.  All rights reserved.
   *
   */
  
  #include <MacHeaders>
  
--- 1,11 ----
  
  /*
!  *  myconsole16.c    ColorQuickDraw version
   *
   *  Copyright (c) 1991 Symantec Corporation.  All rights reserved.
   *
   */
+ #define PLPLOT
  
  #include <MacHeaders>
  
***************
*** 21,32 ****
  #include "string.h"
  #include "signal.h"
  #include "errno.h"
! #include "console.h"
  #include "ansi_private.h"
  
  struct __copt console_options = { 50, 10, "\pconsole", 8, 4, 9, 0, 25, 80, 1 };
  char __log_stdout;
  
  static void InitConsole(void);
  static void ProcessEvent(void);
  static WindowPeek new_console(void);
--- 22,45 ----
  #include "string.h"
  #include "signal.h"
  #include "errno.h"
! /* use new header, tsy */
! #include "myconsole16.h"
  #include "ansi_private.h"
  
  struct __copt console_options = { 50, 10, "\pconsole", 8, 4, 9, 0, 25, 80, 1 };
  char __log_stdout;
  
+ #ifdef PLPLOT
+ /* for plplot redraw, tsy */
+ extern int pl_redraw_mac(WindowPtr wp);
+ RGBColor EraseColor = {65535,65535,65535};
+ RGBColor DarkColor  = {0,0,0};
+ #endif
+ 
+ /* for about ... , tsy */
+ void AboutBox(void);
+ void SetupAboutBox(MenuHandle appleMenu);
+ 
  static void InitConsole(void);
  static void ProcessEvent(void);
  static WindowPeek new_console(void);
***************
*** 320,326 ****
  	setup(wp, &save);
  	if (on) {
  		if (!wp->port.grafProcs) {
! 			wp->port.grafProcs = malloc(sizeof(QDProcs));
  			SetStdProcs(wp->port.grafProcs);
  			wp->port.grafProcs->textProc = (Ptr) myStdText;
  		}
--- 333,339 ----
  	setup(wp, &save);
  	if (on) {
  		if (!wp->port.grafProcs) {
! 			wp->port.grafProcs = malloc(sizeof(CQDProcs));
  			SetStdProcs(wp->port.grafProcs);
  			wp->port.grafProcs->textProc = (Ptr) myStdText;
  		}
***************
*** 468,474 ****
--- 481,490 ----
  		/*  create menus  */
  		
  	InsertMenu(appleMenu = NewMenu(1, "\p\024"), 0);
+ 	AppendMenu(appleMenu, "\p\024");	
  	AddResMenu(appleMenu, 'DRVR');
+ 	/* add about ... tsy */
+     SetupAboutBox(appleMenu);
  	InsertMenu(menu = NewMenu(2, "\pFile"), 0);
  	AppendMenu(menu, "\pQuit/Q");
  	InsertMenu(menu = NewMenu(3, "\pEdit"), 0);
***************
*** 548,555 ****
  doMenu:	
  	switch (hiword(choice)) {
  		case 1:		/*  Apple  */
! 			GetItem(appleMenu, loword(choice), buf);
! 			OpenDeskAcc(buf);
  			break;
  		case 2:		/*  File  */
  			console_options.pause_atexit = 0;
--- 564,575 ----
  doMenu:	
  	switch (hiword(choice)) {
  		case 1:		/*  Apple  */
! 		    if (loword(choice) == 1)
! 		       AboutBox();
! 		    else {
! 			   GetItem(appleMenu, loword(choice), buf);
! 			   OpenDeskAcc(buf);
! 			}
  			break;
  		case 2:		/*  File  */
  			console_options.pause_atexit = 0;
***************
*** 562,567 ****
--- 582,605 ----
  	HiliteMenu(0);
  }
  
+ /*
+  * draw grow icon, tsy
+  */
+  
+ static void
+ drawGrow(Rect bounds)
+ {
+     /* RGBForeColor(&DarkColor);  */     		
+     MoveTo(bounds.right-15,bounds.bottom-15);
+     LineTo(bounds.right,bounds.bottom-15);  
+     MoveTo(bounds.right-15,bounds.bottom-10);
+     LineTo(bounds.right,bounds.bottom-10);  
+     
+     MoveTo(bounds.right-15,bounds.bottom-15);
+     LineTo(bounds.right-15,bounds.bottom);     
+     MoveTo(bounds.right-10,bounds.bottom-15);
+     LineTo(bounds.right-10,bounds.bottom);     
+ }
  
  /*
   *  new_console - create a new console window
***************
*** 582,590 ****
  	GetPort(&savePort);
  	use(0);
  	
! 		/*  create the window  */
  		
! 	wp = (WindowPeek) NewWindow(0, &wbox, console_options.title, 0, console_options.procID, (WindowPtr) -1, 0, 0);
  	MoveWindow((WindowPtr)wp, console_options.left, console_options.top, 0);
  	SetPort((WindowPtr)(c.wp = wp));
  	
--- 620,628 ----
  	GetPort(&savePort);
  	use(0);
  	
! 		/*  create the window , ColorQuickDraw tsy */
  		
! 	wp = (WindowPeek) NewCWindow(0, &wbox, console_options.title, 0, console_options.procID, (WindowPtr) -1, 0, 0);
  	MoveWindow((WindowPtr)wp, console_options.left, console_options.top, 0);
  	SetPort((WindowPtr)(c.wp = wp));
  	
***************
*** 594,601 ****
  	TextSize(console_options.txSize);
  	TextFace(console_options.txFace);
  	GetFontInfo(&fontInfo);
! 	c.height = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
! 	c.width = fontInfo.widMax;
  	
  		/*  set console defaults  */
  		
--- 632,639 ----
  	TextSize(console_options.txSize);
  	TextFace(console_options.txFace);
  	GetFontInfo(&fontInfo);
! 	c.height = fontInfo.ascent + fontInfo.descent + fontInfo.leading; /* char height*/
! 	c.width = fontInfo.widMax;  /*char width*/
  	
  		/*  set console defaults  */
  		
***************
*** 611,616 ****
--- 649,655 ----
  	bounds.bottom = (c.nrows = console_options.nrows) * c.height + 8;
  	bounds.right = (c.ncols = console_options.ncols) * c.width + 8;
  	SizeWindow((WindowPtr)wp, bounds.right, bounds.bottom, 0);
+ 	/* drawGrow(bounds); */  /* tsy */
  	
  		/*  create TE record  */
  		
***************
*** 621,627 ****
  	
  		/*  set up grow/zoom parameters  */
  	
! 	c.limit = botRight(bounds);
  	++c.limit.v, ++c.limit.h;
  	LocalToGlobal(&topLeft(bounds));
  	LocalToGlobal(&botRight(bounds));
--- 660,670 ----
  	
  		/*  set up grow/zoom parameters  */
  	
! 	/* c.limit = botRight(bounds); */
! 	/* reset grow limit, tsy */
! 	c.limit.v = bounds.bottom + 1000;
! 	c.limit.h = bounds.right  + 1000;
! 	
  	++c.limit.v, ++c.limit.h;
  	LocalToGlobal(&topLeft(bounds));
  	LocalToGlobal(&botRight(bounds));
***************
*** 1150,1155 ****
--- 1193,1204 ----
  	return(sel);
  }
  
+ int
+ csetcursor(int sel)
+ {
+     setcursor(sel);
+ }
+ 
  
  /*
   *  deactivate - make sure TE record is inactive
***************
*** 1252,1257 ****
--- 1301,1315 ----
  			BeginUpdate((WindowPtr)wp);
  			EraseRect(&bounds);
  			TEUpdate(&bounds, c.hTE);
+ #ifdef PLPLOT
+             /* redraw PLPLOT graphs, tsy */
+ 			if (pl_redraw_mac((WindowPtr)wp))
+ 			   DrawGrowIcon((WindowPtr)wp); /* draw growIcon */
+ #endif						
+             /* redraw scroll bars, tsy */
+             /*
+             DrawControls((WindowPtr)wp);
+             */		
  			EndUpdate((WindowPtr)wp);
  		}
  		theConsole = wp;
***************
*** 1530,1539 ****
  doCursor(void)
  {
  	Point where;
  	
  	TEIdle(c.hTE);
  	GetMouse(&where);
! 	if (PtInRect(where, &c.wp->port.portRect))
  		SetCursor(*GetCursor(iBeamCursor));
  	else asm {
  		movea.l	(a5),a0
--- 1588,1603 ----
  doCursor(void)
  {
  	Point where;
+ 	Rect  grow;
+ 	/* tsy */
+ 	grow.top    = c.wp->port.portRect.bottom - 14;
+ 	grow.bottom = c.wp->port.portRect.bottom;
+ 	grow.left   = c.wp->port.portRect.right - 14;
+ 	grow.right  = c.wp->port.portRect.right;
  	
  	TEIdle(c.hTE);
  	GetMouse(&where);
! 	if (PtInRect(where, &c.wp->port.portRect) && !PtInRect(where, &grow))
  		SetCursor(*GetCursor(iBeamCursor));
  	else asm {
  		movea.l	(a5),a0
