[comp.windows.x] xterm Tek mode with selective erase

paul%zaphod@GARGOYLE.UCHICAGO.EDU (05/19/89)

Selective erase is a useful feature of some Tektronix emulators.  As
this feature was missing from the xterm Tek mode provided with the
X11R3 distribution, we offer here some diffs which add it in.

The erase mode is entered with ESC DEL and exited with CR.  During the
erase mode, all drawing operations will then be done with the
background and foreground colors switched.

Hopefully, if there is enough interest, these changes can be
incorporated into the official X11R4 xterm release.



--Paul Burchard		paul@zaphod.uchicago.edu


----------------------- SLICE AND DICE HERE -------------------------------
*** TekPrsTbl.c.old	Thu Feb 25 23:12:49 1988
--- TekPrsTbl.c	Sat Dec 24 12:04:28 1988
***************
*** 218,224 ****
  CASE_UP,
  /*	NP		CR		SO		SI	*/
  CASE_PAGE,
! CASE_IGNORE,
  CASE_BYP_STATE,
  CASE_BYP_STATE,
  /*	DLE		DC1		DC2		DC3	*/
--- 218,224 ----
  CASE_UP,
  /*	NP		CR		SO		SI	*/
  CASE_PAGE,
! CASE_CR,/*!!!*/
  CASE_BYP_STATE,
  CASE_BYP_STATE,
  /*	DLE		DC1		DC2		DC3	*/
***************
*** 544,550 ****
  CASE_UP,
  /*	NP		CR		SO		SI	*/
  CASE_PAGE,
! CASE_IGNORE,
  CASE_APL,
  CASE_ASCII,
  /*	DLE		DC1		DC2		DC3	*/
--- 544,550 ----
  CASE_UP,
  /*	NP		CR		SO		SI	*/
  CASE_PAGE,
! CASE_CR,/*!!!*/
  CASE_APL,
  CASE_ASCII,
  /*	DLE		DC1		DC2		DC3	*/
***************
*** 686,692 ****
  CASE_CURSTATE,
  CASE_CURSTATE,
  CASE_IGNORE,
! CASE_CURSTATE,
  };
  
  int Tipltable[] = {
--- 686,692 ----
  CASE_CURSTATE,
  CASE_CURSTATE,
  CASE_IGNORE,
! CASE_ERASE,/*!!!*/
  };
  
  int Tipltable[] = {
*** Tekproc.c.old	Sat Feb 27 14:27:55 1988
--- Tekproc.c	Thu Dec 29 20:46:39 1988
***************
*** 248,253 ****
--- 248,254 ----
  	char ch;
  	int arg;
  	int Tinput();
+ 	XGCValues values;/*!!!*/
  
  	for( ; ; )
  		switch(Tparsestate[c = input()]) {
***************
*** 490,502 ****
  
  		 case CASE_CR:
  			/* CR */
! 			if(screen->TekGIN)
  				TekGINoff();
! 			if(nplot > 0)	/* flush line Tbuffer */
  				TekFlush();
! 			screen->cur_X = screen->margin == MARGIN1 ? 0 :
! 			 TEKWIDTH / 2;
! 			Tparsestate = curstate = Talptable;
  			break;
  
  		 case CASE_ESC_STATE:
--- 491,519 ----
  
  		 case CASE_CR:
  			/* CR */
! 			/*!!!(*/
!                         if (screen->erase == TRUE)
! 			    {
! 			    Pixel pix;
! 			    TekFlush();
! 			    pix = screen->Tforeground;
! 			    screen->Tforeground
! 				= values.foreground = screen->Tbackground;
! 			    screen->Tbackground = pix;
! 			    XChangeGC(screen->display, screen->TnormalGC,
! 				  GCForeground, &values);
! 			    screen->erase = FALSE;
! 			    }/*)!!!*/
! 			else 
! 			    {
! 			    if(screen->TekGIN)
  				TekGINoff();
! 			    if(nplot > 0)	/* flush line Tbuffer */
  				TekFlush();
! 			    screen->cur_X = screen->margin == MARGIN1 ? 0 :
! 				TEKWIDTH / 2;
! 			    Tparsestate = curstate = Talptable;
! 			    }
  			break;
  
  		 case CASE_ESC_STATE:
***************
*** 539,544 ****
--- 556,577 ----
  			do_osc(Tinput);
  			Tparsestate = curstate;
  			break;
+                  case CASE_ERASE:
+ 			/*!!!(*/
+                         if (screen->erase == FALSE)
+ 			    {
+ 			    Pixel pix;
+ 			    TekFlush();
+ 			    pix = screen->Tforeground;
+ 			    screen->Tforeground
+ 				= values.foreground = screen->Tbackground;
+ 			    screen->Tbackground = pix;
+ 			    XChangeGC(screen->display, screen->TnormalGC,
+ 				  GCForeground, &values);
+ 			    screen->erase = TRUE;
+ 			    }
+ 			break;
+ 			/*)!!!*/
  		}
  }			
  
*** Tekparse.h.old	Thu Feb 25 23:12:49 1988
--- Tekparse.h	Sat Dec 24 12:05:20 1988
***************
*** 63,65 ****
--- 63,66 ----
  #define	CASE_SP		(CASE_LF + 1)
  #define	CASE_PRINT	(CASE_SP + 1)
  #define	CASE_OSC	(CASE_PRINT + 1)
+ #define CASE_ERASE      (CASE_OSC + 1) /*!!!*/
*** ptyx.h.old	Thu Feb 25 23:13:08 1988
--- ptyx.h	Thu Dec 29 19:12:41 1988
***************
*** 344,349 ****
--- 344,350 ----
  	Atom*		selection_atoms; /* which selections we own */
  	Cardinal	sel_atoms_size;	/*  how many atoms allocated */
  	Cardinal	selection_count; /* how many atoms in use */
+  	int		erase;		/* nonzero if in erase mode !!!	*/
  } TScreen;
  
  /* meaning of bits in screen.select flag */