tn5250j/src/org/tn5250j TN5250jConstants.java,1.48,1.49 ScreenPlanes.java,1.1,1.2 GuiGraphicBuffer.java,1.23,1.24 tnvt.java,1.49,1.50 Screen5250.java,1.69,1.70

"Kenneth J. Pouncey" <[email protected]> Sun, 11 Jul 2004 08:17:31 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28466/src/org/tn5250j

Modified Files:
	TN5250jConstants.java ScreenPlanes.java GuiGraphicBuffer.java 
	tnvt.java Screen5250.java 
Log Message:
first part Phase III of headless changes.  Change to use screen planes.
Making it all work together now by accessing the planes.

Index: TN5250jConstants.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/TN5250jConstants.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** TN5250jConstants.java	23 Jun 2004 11:00:03 -0000	1.48
--- TN5250jConstants.java	11 Jul 2004 08:17:28 -0000	1.49
***************
*** 384,386 ****
--- 384,428 ----
     public static final byte CMD_READ_SCREEN_TO_PRINT = (byte)0x66; // 102
  
+    // PLANES
+    public static final int PLANE_TEXT   =  1;
+    public static final int PLANE_COLOR   =  2;
+    public static final int PLANE_FIELD   =  4;
+    public static final int PLANE_EXTENDED   =  8;
+    public static final int PLANE_EXTENDED_GRAPHIC   =  16;
+    public static final int PLANE_EXTENDED_FIELD   =  32;
+ 
+    // COLOR_BG
+    public static final char COLOR_BG_BLACK   =  0;
+    public static final char COLOR_BG_BLUE   =  1;
+    public static final char COLOR_BG_GREEN   =  2;
+    public static final char COLOR_BG_CYAN   =  3;
+    public static final char COLOR_BG_RED   =  4;
+    public static final char COLOR_BG_MAGENTA   =  5;
+    public static final char COLOR_BG_YELLOW   =  6;
+    public static final char COLOR_BG_WHITE   =  7;
+ 
+    // COLOR_FG
+    public static final char COLOR_FG_BLACK   =  0;
+    public static final char COLOR_FG_BLUE   =  1;
+    public static final char COLOR_FG_GREEN   =  2;
+    public static final char COLOR_FG_CYAN   =  3;
+    public static final char COLOR_FG_RED   =  4;
+    public static final char COLOR_FG_MAGENTA   =  5;
+    public static final char COLOR_FG_YELLOW   =  6;
+    public static final char COLOR_FG_WHITE   =  7;
+    public static final char COLOR_FG_BROWN   =  0xE;
+    public static final char COLOR_FG_GRAY   =  8;
+    public static final char COLOR_FG_LIGHT_BLUE   =  9;
+    public static final char COLOR_FG_LIGHT_GREEN   =  0xA;
+    public static final char COLOR_FG_LIGHT_CYAN   =  0xB;
+    public static final char COLOR_FG_LIGHT_RED   =  0xC;
+    public static final char COLOR_FG_LIGHT_MAGENTA   =  0xD;
+    public static final char COLOR_FG_WHITE_HIGH   =  0xF;
+ 
+    public static final int EXTENDED_5250_REVERSE   =  0x10;
+    public static final int EXTENDED_5250_UNDERLINE   =  0x08;
+    public static final int EXTENDED_5250_BLINK   =  0x04;
+    public static final int EXTENDED_5250_COL_SEP   =  0x02;
+    public static final int EXTENDED_5250_NON_DSP   =  0x01;
+ 
  }

Index: ScreenPlanes.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/ScreenPlanes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ScreenPlanes.java	9 Jul 2004 04:32:58 -0000	1.1
--- ScreenPlanes.java	11 Jul 2004 08:17:28 -0000	1.2
***************
*** 26,30 ****
  package org.tn5250j;
  
! public class ScreenPlanes {
  
     Screen5250 scr;
--- 26,30 ----
  package org.tn5250j;
  
! public class ScreenPlanes implements TN5250jConstants {
  
[...1358 lines suppressed...]
! 	   // now lets make sure there are no more than numSuff spaces after option
! 	   while (hs && (++sp < lenScreen && screen[sp] <= ' '
! 	                  || screen[sp] == suff )) {
! 	      if (sp - x >= numSuff || screen[sp] == suff ||
! 	                  screen[sp] == '.' ||
! 	               screen[sp] == '*') {
! 	         hs =false;
! 	//         System.out.println(" hs3 false at " + sp + " " + screen[sp].getChar());
! 	         break;
! 	      }
! 	   }
! 	   if (hs && !Character.isLetterOrDigit(screen[sp]))
! 	      hs = false;
! 	   if (hs) {
! 	      return os;
! 	   }
! 	   return -1;
! 	}
  
     public static final int NO_GUI = 0;

Index: tnvt.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tnvt.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** tnvt.java	9 Jul 2004 04:33:58 -0000	1.49
--- tnvt.java	11 Jul 2004 08:17:28 -0000	1.50
***************
*** 1,4 ****
  /**
!  * Title: tn5250J Copyright: Copyright (c) 2001 Company:
   *
   * @author Kenneth J. Pouncey
--- 1,5 ----
  /**
!  * Title: tnvt.java 
!  * Copyright: Copyright (c) 2001 Company:
   *
   * @author Kenneth J. Pouncey

Index: GuiGraphicBuffer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** GuiGraphicBuffer.java	9 Jul 2004 04:33:58 -0000	1.23
--- GuiGraphicBuffer.java	11 Jul 2004 08:17:28 -0000	1.24
***************
*** 40,44 ****
  import org.tn5250j.tools.GUIGraphicsUtils;
  
! public class GuiGraphicBuffer implements ScreenOIAListener, ScreenListener {
  
     private BufferedImage bi;
--- 40,44 ----
  import org.tn5250j.tools.GUIGraphicsUtils;
  
! public class GuiGraphicBuffer implements ScreenOIAListener, ScreenListener, TN5250jConstants {
  
     private BufferedImage bi;
***************
*** 72,76 ****
     private Graphics2D gg2d;
     private Screen5250 screen;
! 
     private TN5250jLogger log = TN5250jLogFactory.getLogger ("GFX");
  
--- 72,77 ----
     private Graphics2D gg2d;
     private Screen5250 screen;
!    private Data updateRect;
!    
     private TN5250jLogger log = TN5250jLogFactory.getLogger ("GFX");
  
***************
*** 538,541 ****
--- 539,546 ----
        int numCols = screen.getCols();
  
+ 
+       updateRect = new Data (sr,sc,er,ec);
+ 
+       int pos = 0;
  		while (rows-- >= 0) {
  			cols = ec - sc;
***************
*** 544,548 ****
  				if (lc >= 0 && lc < lenScreen) {
  //					drawChar(gg2d,screen.screen[lc],screen.getRow(lc),screen.getCol(lc));
! 					drawChar(gg2d,lc,screen.getRow(lc),screen.getCol(lc));
                 lc++;
  				}
--- 549,553 ----
  				if (lc >= 0 && lc < lenScreen) {
  //					drawChar(gg2d,screen.screen[lc],screen.getRow(lc),screen.getCol(lc));
! 					drawChar(gg2d,pos++,screen.getRow(lc),screen.getCol(lc));
                 lc++;
  				}
***************
*** 724,1111 ****
     public static final int BUTTON_LAST = 31;
  
-    public final void drawChar(Graphics2D g, ScreenChar sc, int row, int col) {
- 
-       Screen5250 s = screen;
- 
-       Color fg = sc.fg;
-       Color bg = sc.bg;
- 
-       cArea.setRect((s.fmWidth*col),s.fmHeight * row,s.fmWidth,s.fmHeight);
-       int x = s.fmWidth * col;
-       int y = s.fmHeight * row;
-       int cy = (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading()));
- 
- //      int x = sc.x;
- //      int y = sc.y;
-       int attr = sc.attr;
- //      int cy = sc.cy;
- 
-       if (sc.attributePlace && s.isShowHex()) {
- //      if ((sc.sChar[0] == 0x20 || sc.sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
-          Font f = g.getFont();
- 
-          Font k = f.deriveFont(f.getSize2D()/2);
-          g.setFont(k);
-          g.setColor(s.colorHexAttr);
-          char[] a = Integer.toHexString(attr).toCharArray();
-          g.drawChars(a, 0, 1, x, y + (int)(s.fmHeight /2));
-          g.drawChars(a, 1, 1, x+(int)(s.fmWidth/2),
-             (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
-          g.setFont(f);
- //return;
-       }
- 
-       if(!sc.nonDisplay && !sc.attributePlace) {
- 
-          if (!sc.useGui) {
-             g.setColor(bg);
-             g.fill(sc.cArea);
-          }
-          else {
- 
-             if (bg == s.colorBg && sc.whichGui >= FIELD_LEFT && sc.whichGui <= FIELD_ONE)
-                g.setColor(s.colorGUIField);
-             else
-                g.setColor(bg);
- 
-             g.fill(sc.cArea);
- 
-          }
- 
-          if (sc.useGui && (sc.whichGui < FIELD_LEFT)) {
-             int w = 0;
- 
-             g.setColor(fg);
- 
-             switch (sc.whichGui) {
- 
-                case UPPER_LEFT:
-                   if (sc.sChar[0] == '.') {
-                      if (s.isUsingGuiInterface()) {
-                         GUIGraphicsUtils.drawWinUpperLeft(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              s.colorBlue,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
-                      }
-                      else {
- 
-                         GUIGraphicsUtils.drawWinUpperLeft(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
-                      }
-                   }
-                break;
-                case UPPER:
-                   if (sc.sChar[0] == '.') {
- 
-                      if (s.isUsingGuiInterface()) {
-                         GUIGraphicsUtils.drawWinUpper(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              s.colorBlue,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
- 
-                      }
-                      else {
- 
-                         GUIGraphicsUtils.drawWinUpper(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
-                      }
-                   }
-                break;
-                case UPPER_RIGHT:
-                   if (sc.sChar[0] == '.') {
-                      if (s.isUsingGuiInterface()) {
- 
-                         GUIGraphicsUtils.drawWinUpperRight(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              s.colorBlue,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
- 
-                      }
-                      else {
- 
-                         GUIGraphicsUtils.drawWinUpperRight(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
-                      }
-                   }
-                break;
-                case LEFT:
-                   if (sc.sChar[0] == ':') {
-                      if (s.isUsingGuiInterface()) {
-                         GUIGraphicsUtils.drawWinLeft(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              bg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
- 
-                      }
-                      else {
- 
-                         GUIGraphicsUtils.drawWinLeft(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
-                         g.drawLine(x + s.fmWidth / 2,
-                                     y,
-                                     x + s.fmWidth / 2,
-                                     y + s.fmHeight);
-                      }
-                   }
-                break;
-                case RIGHT:
-                   if (sc.sChar[0] == ':') {
-                      if (s.isUsingGuiInterface()) {
-                         GUIGraphicsUtils.drawWinRight(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              bg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
- 
-                      }
-                      else {
-                         GUIGraphicsUtils.drawWinRight(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
-                      }
-                   }
-                break;
-                case LOWER_LEFT:
-                   if (sc.sChar[0] == ':') {
- 
-                      if (s.isUsingGuiInterface()) {
- 
-                         GUIGraphicsUtils.drawWinLowerLeft(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              bg,
-                                              x,y,s.fmWidth,s.fmHeight);
- 
- 
-                      }
-                      else {
- 
-                         GUIGraphicsUtils.drawWinLowerLeft(g,
-                                              GUIGraphicsUtils.WINDOW_NORMAL,
-                                              fg,
-                                              x,y,s.fmWidth,s.fmHeight);
-                      }
-                   }
-                break;
-                case BOTTOM:
-                   if (sc.sChar[0] == '.') {
- 
-                      if (s.isUsingGuiInterface()) {
- 
- 
-                         GUIGraphicsUtils.drawWinBottom(g,
-                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
-                                              bg,
-                                              x,y,s.fmWidth,s.fmHeight);
  
  
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinBottom(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
!                      }
!                   }
!                break;
! 
!                case LOWER_RIGHT:
!                   if (sc.sChar[0] == ':') {
!                      if (s.isUsingGuiInterface()) {
! 
!                         GUIGraphicsUtils.drawWinLowerRight(g,
!                                              GUIGraphicsUtils.WINDOW_GRAPHIC,
!                                              bg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                      else {
! 
!                         GUIGraphicsUtils.drawWinLowerRight(g,
!                                              GUIGraphicsUtils.WINDOW_NORMAL,
!                                              fg,
!                                              x,y,s.fmWidth,s.fmHeight);
! 
!                      }
!                   }
!                break;
! 
!             }
!          }
! 
!          else {
!             if (sc.sChar[0] != 0x0) {
!             // use this until we define colors for gui stuff
!                if ((sc.useGui && sc.whichGui < BUTTON_LEFT) && (fg == s.colorGUIField))
! 
!                   g.setColor(Color.black);
!                else
!                   g.setColor(fg);
! 
!                   try {
!                      if (sc.useGui)
  
!                         if (sc.sChar[0] == 0x1C)
!                            g.drawChars(sc.dupChar, 0, 1, x+1, cy -2);
!                         else
!                            g.drawChars(sc.sChar, 0, 1, x+1, cy -2);
!                      else
!                         if (sc.sChar[0] == 0x1C)
!                            g.drawChars(sc.dupChar, 0, 1, x, cy -2);
!                         else
!                            g.drawChars(sc.sChar, 0, 1, x, cy -2);
!                   }
!                   catch (IllegalArgumentException iae) {
!                      System.out.println(" ScreenChar iae " + iae.getMessage());
  
!                   }
!             }
!             if(sc.underLine ) {
  
!                if (!sc.useGui || s.guiShowUnderline) {
!                   g.setColor(fg);
! //                  g.drawLine(x, cy -2, (int)(x + s.fmWidth), cy -2);
! //                  g.drawLine(x, (int)(y + (s.fmHeight - s.lm.getLeading()-5)), (int)(x + s.fmWidth), (int)(y + (s.fmHeight - s.lm.getLeading())-5));
!                   g.drawLine(x, (int)(y + (s.fmHeight - (s.lm.getLeading() + s.lm.getDescent()))), (int)(x + s.fmWidth), (int)(y + (s.fmHeight -(s.lm.getLeading() + s.lm.getDescent()))));
  
-                }
-             }
  
!             if(sc.colSep) {
!                g.setColor(s.colorSep);
!                switch (s.getColSepLine()) {
!                   case 0:  // line
!                      g.drawLine(x, y, x, y + s.fmHeight - 1);
!                      g.drawLine(x + s.fmWidth - 1, y, x + s.fmWidth - 1, y + s.fmHeight);
!                      break;
!                   case 1:  // short line
!                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-4, x, y + s.fmHeight);
!                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4, x + s.fmWidth - 1, y + s.fmHeight);
!                      break;
!                   case 2:  // dot
!                      g.drawLine(x,  y + s.fmHeight - (int)s.lm.getLeading()-3, x, y + s.fmHeight - (int)s.lm.getLeading()-4);
!                      g.drawLine(x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-3, x + s.fmWidth - 1, y + s.fmHeight - (int)s.lm.getLeading()-4);
!                      break;
!                   case 3:  // hide
!                      break;
!                }
!             }
!          }
        }
  
!       if (sc.useGui & (sc.whichGui >= FIELD_LEFT)) {
!             int w = 0;
! 
!             switch (sc.whichGui) {
! 
!                case FIELD_LEFT:
!                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
!                case FIELD_MIDDLE:
!                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
!                break;
!                case FIELD_RIGHT:
!                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
!                break;
! 
!                case FIELD_ONE:
!                   GUIGraphicsUtils.draw3DOne(g, GUIGraphicsUtils.INSET, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
! 
!                case BUTTON_LEFT:
!                case BUTTON_LEFT_UP:
!                case BUTTON_LEFT_DN:
!                case BUTTON_LEFT_EB:
! 
!                   GUIGraphicsUtils.draw3DLeft(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                   break;
! 
!                case BUTTON_MIDDLE:
!                case BUTTON_MIDDLE_UP:
!                case BUTTON_MIDDLE_DN:
!                case BUTTON_MIDDLE_EB:
! 
!                   GUIGraphicsUtils.draw3DMiddle(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
!                   break;
! 
!                case BUTTON_RIGHT:
!                case BUTTON_RIGHT_UP:
!                case BUTTON_RIGHT_DN:
!                case BUTTON_RIGHT_EB:
! 
!                   GUIGraphicsUtils.draw3DRight(g, GUIGraphicsUtils.RAISED, x,y,
!                                              s.fmWidth,s.fmHeight);
! 
!                break;
! 
!                // scroll bar
!                case BUTTON_SB_UP:
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 1, x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
!                   break;
! 
!                // scroll bar
!                case BUTTON_SB_DN:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.RAISED, 2, x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
!                // scroll bar
!                case BUTTON_SB_GUIDE:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 0,x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
! 
!                // scroll bar
!                case BUTTON_SB_THUMB:
! 
!                   GUIGraphicsUtils.drawScrollBar(g, GUIGraphicsUtils.INSET, 3,x,y,
!                                              s.fmWidth,s.fmHeight,
!                                              s.colorWhite,s.colorBg);
! 
! 
!                   break;
! 
!             }
!          }
  
     }
  
-    Rectangle csArea = new Rectangle();
-    char sChar[] = new char[1];
     // Dup Character array for display output
     public static final transient char[] dupChar = {'*'};
--- 729,777 ----
     public static final int BUTTON_LAST = 31;
  
  
+    protected Data fillData(int startRow, int startCol, int endRow, int endCol) {
  
!       return new Data(startRow, startCol, endRow, endCol );
  
!    }
  
!    Rectangle csArea = new Rectangle();
!    char sChar[] = new char[1];
  
!    protected class Data {
  
  
!       public Data(char[] text, char[] color, char[] extended) {
!          this.text = text;
!          this.color = color;
!          this.extended = extended;
!          this.graphic = null;
!          this.field = null;
        }
  
!       public Data(int startRow, int startCol, int endRow, int endCol) {
!          startRow++;
!          startCol++;
!          endRow++;
!          endCol++;
!          int size = ((endCol - startCol) + 1) * ((endRow - startRow) +1);
!          text = new char[size];
!          color = new char[size];
!          extended =new char[size];
!          graphic = new char[size];
!          field = null;
!          screen.GetScreenRect(text, size, startRow, startCol, endRow, endCol, PLANE_TEXT);
!          screen.GetScreenRect(color, size, startRow, startCol, endRow, endCol, PLANE_COLOR);
!          screen.GetScreenRect(extended, size, startRow, startCol, endRow, endCol, PLANE_EXTENDED);
!          screen.GetScreenRect(graphic, size, startRow, startCol, endRow, endCol, PLANE_EXTENDED_GRAPHIC);
!       }
  
+       public char[] text;
+       public char[] color;
+       public char[] extended;
+       public final char[] graphic;
+       public final char[] field;
     }
  
     // Dup Character array for display output
     public static final transient char[] dupChar = {'*'};
***************
*** 1115,1124 ****
        ScreenPlanes planes = s.planes;
  
!       int attr = planes.getCharAttr(pos);
!       sChar[0] = planes.getChar(pos);
!       setCharAttr(attr);
!       boolean attributePlace = planes.isAttributePlace(pos);
!       boolean useGui = planes.isUseGui(pos);
!       int whichGui = planes.getWhichGUI(pos);
  
        csArea.setRect((s.fmWidth*col),s.fmHeight * row,s.fmWidth,s.fmHeight);
--- 781,792 ----
        ScreenPlanes planes = s.planes;
  
! //      int attr = planes.getCharAttr(pos);
!       int attr = planes.getCharAttr(s.getPos(row,col));
!       sChar[0] = updateRect.text[pos];
!       setDrawAttr(pos);
!       boolean attributePlace = planes.isAttributePlace(s.getPos(row,col));
!       //attributePlace = true;
!       int whichGui = updateRect.graphic[pos];
!       boolean useGui = whichGui == 0 ? false : true;
  
        csArea.setRect((s.fmWidth*col),s.fmHeight * row,s.fmWidth,s.fmHeight);
***************
*** 1497,1500 ****
--- 1165,1199 ----
     }
  
+    protected Color getColor(char color, boolean background) {
+       int c = 0;
+       if (background)
+          // background
+          c = (color & 0xff00) >> 8;
+       else
+          // foreground
+          c = color & 0x00ff;
+ 
+       switch (c) {
+          case COLOR_FG_BLACK:
+             return screen.colorBg;
+          case COLOR_FG_GREEN:
+             return screen.colorGreen;
+          case COLOR_FG_BLUE:
+             return screen.colorBlue;
+          case COLOR_FG_RED:
+             return screen.colorRed;
+          case COLOR_FG_YELLOW:
+             return screen.colorYellow;
+          case COLOR_FG_CYAN:
+             return screen.colorTurq;
+          case COLOR_FG_WHITE:
+             return screen.colorWhite;
+          case COLOR_FG_MAGENTA:
+             return screen.colorPink;
+          default:
+            return Color.orange;
+       }
+    }
+ 
     boolean      colSep = false;
     boolean   underLine = false;
***************
*** 1503,1507 ****
     Color bg;
  
!    private void setCharAttr(int attr) {
  
        Screen5250 s = screen;
--- 1202,1206 ----
     Color bg;
  
!    private void setDrawAttr(int pos) {
  
        Screen5250 s = screen;
***************
*** 1510,1680 ****
        nonDisplay = false;
  
!       switch(attr) {
!          case 32: // green normal
!             fg = s.colorGreen;
!             bg = s.colorBg;
!             break;
! 
!          case 33: // green/revers
!             fg = s.colorBg;
!             bg = s.colorGreen;
!             break;
! 
!          case 34: // white normal
!             fg = s.colorWhite;
!             bg = s.colorBg;
!             break;
! 
!          case 35: // white/reverse
!             fg = s.colorBg;
!             bg = s.colorWhite;
!             break;
! 
!          case 36: // green/underline
!             fg = s.colorGreen;
!             bg = s.colorBg;
!             underLine = true;
!             break;
! 
!          case 37: // green/reverse/underline
!             fg = s.colorBg;
!             bg = s.colorGreen;
!             underLine = true;
!             break;
! 
!          case 38: // white/underline
!             fg = s.colorWhite;
!             bg = s.colorBg;
!             underLine = true;
!             break;
! 
!          case 39:
!             nonDisplay = true;
!             break;
! 
!          case 40:
!          case 42: // red/normal
!             fg = s.colorRed;
!             bg = s.colorBg;
!             break;
! 
!          case 41:
!          case 43: // red/reverse
!             fg = s.colorBg;
!             bg = s.colorRed;
!             break;
! 
!          case 44:
!          case 46: // red/underline
!             fg = s.colorRed;
!             bg = s.colorBg;
!             underLine = true;
!             break;
! 
!          case 45: // red/reverse/underline
!             fg = s.colorBg;
!             bg = s.colorRed;
!             underLine = true;
!             break;
! 
!          case 47:
!             nonDisplay = true;
!             break;
! 
!          case 48:
!             fg = s.colorTurq;
!             bg = s.colorBg;
!             colSep = true;
!             break;
! 
!          case 49:
!             fg = s.colorBg;
!             bg = s.colorTurq;
!             colSep = true;
!             break;
! 
!          case 50:
!             fg = s.colorYellow;
!             bg = s.colorBg;
!             colSep = true;
!             break;
! 
!          case 51:
!             fg = s.colorBg;
!             bg = s.colorYellow;
!             colSep = true;
!             break;
! 
!          case 52:
!             fg = s.colorTurq;
!             bg = s.colorBg;
! //            colSep = true;
!             underLine = true;
!             break;
! 
!          case 53:
!             fg = s.colorBg;
!             bg = s.colorTurq;
! //            colSep = true;
!             underLine = true;
!             break;
! 
!          case 54:
!             fg = s.colorYellow;
!             bg = s.colorBg;
! //            colSep = true;
!             underLine = true;
!             break;
! 
!          case 55:
!             nonDisplay = true;
!             break;
! 
!          case 56: // pink
!             fg = s.colorPink;
!             bg = s.colorBg;
!             break;
! 
!          case 57: // pink/reverse
!             fg = s.colorBg;
!             bg = s.colorPink;
!             break;
! 
!          case 58: // blue/reverse
!             fg = s.colorBlue;
!             bg = s.colorBg;
!             break;
! 
!          case 59: // blue
!             fg = s.colorBg;
!             bg = s.colorBlue;
!             break;
! 
!          case 60: // pink/underline
!             fg = s.colorPink;
!             bg = s.colorBg;
!             underLine = true;
!             break;
! 
!          case 61: // pink/reverse/underline
!             fg = s.colorBg;
!             bg = s.colorPink;
!             underLine = true;
!             break;
! 
!          case 62: // blue/underline
!             fg = s.colorBlue;
!             bg = s.colorBg;
!             underLine = true;
!             break;
! 
!          case 63:  // nondisplay
!             nonDisplay = true;
!             break;
!          default:
!             fg = s.colorYellow;
!             break;
  
!       }
  
     }
--- 1209,1385 ----
        nonDisplay = false;
  
!       fg = getColor(updateRect.color[pos],false);
!       bg = getColor(updateRect.color[pos],true);
!       underLine = (updateRect.extended[pos] & EXTENDED_5250_UNDERLINE) != 0;
!       colSep = (updateRect.extended[pos] & EXTENDED_5250_COL_SEP) != 0;
!       nonDisplay = (updateRect.extended[pos] & EXTENDED_5250_NON_DSP) != 0;
!       
! //	      switch(pos) {
! //	         case 32: // green normal
! //	            fg = s.colorGreen;
! //	            bg = s.colorBg;
! //	            break;
! //	
! //	         case 33: // green/revers
! //	            fg = s.colorBg;
! //	            bg = s.colorGreen;
! //	            break;
! //	
! //	         case 34: // white normal
! //	            fg = s.colorWhite;
! //	            bg = s.colorBg;
! //	            break;
! //	
! //	         case 35: // white/reverse
! //	            fg = s.colorBg;
! //	            bg = s.colorWhite;
! //	            break;
! //	
! //	         case 36: // green/underline
! //	            fg = s.colorGreen;
! //	            bg = s.colorBg;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 37: // green/reverse/underline
! //	            fg = s.colorBg;
! //	            bg = s.colorGreen;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 38: // white/underline
! //	            fg = s.colorWhite;
! //	            bg = s.colorBg;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 39:
! //	            nonDisplay = true;
! //	            break;
! //	
! //	         case 40:
! //	         case 42: // red/normal
! //	            fg = s.colorRed;
! //	            bg = s.colorBg;
! //	            break;
! //	
! //	         case 41:
! //	         case 43: // red/reverse
! //	            fg = s.colorBg;
! //	            bg = s.colorRed;
! //	            break;
! //	
! //	         case 44:
! //	         case 46: // red/underline
! //	            fg = s.colorRed;
! //	            bg = s.colorBg;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 45: // red/reverse/underline
! //	            fg = s.colorBg;
! //	            bg = s.colorRed;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 47:
! //	            nonDisplay = true;
! //	            break;
! //	
! //	         case 48:
! //	            fg = s.colorTurq;
! //	            bg = s.colorBg;
! //	            colSep = true;
! //	            break;
! //	
! //	         case 49:
! //	            fg = s.colorBg;
! //	            bg = s.colorTurq;
! //	            colSep = true;
! //	            break;
! //	
! //	         case 50:
! //	            fg = s.colorYellow;
! //	            bg = s.colorBg;
! //	            colSep = true;
! //	            break;
! //	
! //	         case 51:
! //	            fg = s.colorBg;
! //	            bg = s.colorYellow;
! //	            colSep = true;
! //	            break;
! //	
! //	         case 52:
! //	            fg = s.colorTurq;
! //	            bg = s.colorBg;
! //	//            colSep = true;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 53:
! //	            fg = s.colorBg;
! //	            bg = s.colorTurq;
! //	//            colSep = true;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 54:
! //	            fg = s.colorYellow;
! //	            bg = s.colorBg;
! //	//            colSep = true;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 55:
! //	            nonDisplay = true;
! //	            break;
! //	
! //	         case 56: // pink
! //	            fg = s.colorPink;
! //	            bg = s.colorBg;
! //	            break;
! //	
! //	         case 57: // pink/reverse
! //	            fg = s.colorBg;
! //	            bg = s.colorPink;
! //	            break;
! //	
! //	         case 58: // blue/reverse
! //	            fg = s.colorBlue;
! //	            bg = s.colorBg;
! //	            break;
! //	
! //	         case 59: // blue
! //	            fg = s.colorBg;
! //	            bg = s.colorBlue;
! //	            break;
! //	
! //	         case 60: // pink/underline
! //	            fg = s.colorPink;
! //	            bg = s.colorBg;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 61: // pink/reverse/underline
! //	            fg = s.colorBg;
! //	            bg = s.colorPink;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 62: // blue/underline
! //	            fg = s.colorBlue;
! //	            bg = s.colorBg;
! //	            underLine = true;
! //	            break;
! //	
! //	         case 63:  // nondisplay
! //	            nonDisplay = true;
! //	            break;
! //	         default:
! //	            fg = s.colorYellow;
! //	            break;
  
!       
  
     }

Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** Screen5250.java	9 Jul 2004 04:33:58 -0000	1.69
--- Screen5250.java	11 Jul 2004 08:17:28 -0000	1.70
***************
*** 3360,3363 ****
--- 3360,3539 ----
  	}
  
+    /**
+     * <p>
+     *  GetScreen retrieves the various planes associated with the presentation
+     *  space. The data is returned as a linear array of character values in the
+     *  array provided. The array is not terminated by a null character except
+     *  when data is retrieved from the text plane, in which case a single null
+     *  character is appended.
+     *  </p>
+     *  <p>
+     *  The application must supply a buffer for the returned data and the length
+     *  of the buffer. Data is returned starting from the beginning of the
+     *  presentation space and continuing until the buffer is full or the entire
+     *  plane has been copied. For text plane data, the buffer must include one
+     *  extra position for the terminating null character.
+     *  <p>
+     *
+     * @param buffer
+     * @param bufferLength
+     * @param plane
+     * @return The number of characters copied to the buffer
+     * @throws OhioException
+     */
+    public synchronized int GetScreen(char buffer[], int bufferLength, int plane)
+ //                                       throws OhioException {
+                                        {
+       return GetScreen(buffer,bufferLength,0,lenScreen,plane);
+ 
+    }
+ 
+    /**
+     * <p>
+     *  GetScreen retrieves the various planes associated with the presentation
+     *  space. The data is returned as a linear array of character values in the
+     *  array provided. The array is not terminated by a null character except
+     *  when data is retrieved from the text plane, in which case a single null
+     *  character is appended.
+     * </p>
+     * <p>
+     * The application must supply a buffer for the returned data and the length
+     * of the buffer. Data is returned starting from the given position and
+     * continuing until the specified number of characters have been copied, the
+     * buffer is full or the entire plane has been copied. For text plane data,
+     * the buffer must include one extra position for the terminating null character.
+     * </p>
+     *
+     * @param buffer
+     * @param bufferLength
+     * @param from
+     * @param length
+     * @param plane
+     * @return The number of characters copied to the buffer
+     * @throws OhioException
+     */
+    public synchronized int GetScreen(char buffer[], int bufferLength, int from,
+                                     int length, int plane)
+ //                                    throws OhioException {
+                                     {
+ 
+       return planes.GetScreen(buffer,bufferLength, from, length, plane);
+    }
+ 
+    /**
+     * <p>
+     *  GetScreen retrieves the various planes associated with the presentation
+     *  space. The data is returned as a linear array of character values in the
+     *  array provided. The array is not terminated by a null character except
+     *  when data is retrieved from the text plane, in which case a single null
+     *  character is appended.
+     *  </p>
+     *  <p>
+     *  The application must supply a buffer for the returned data and the length
+     *  of the buffer. Data is returned starting from the given coordinates and
+     *  continuing until the specified number of characters have been copied,
+     *  the buffer is full, or the entire plane has been copied. For text plane
+     *  data, the buffer must include one extra position for the terminating null
+     *  character.
+     *  </p>
+     *
+     * @param buffer
+     * @param bufferLength
+     * @param row
+     * @param col
+     * @param length
+     * @param plane
+     * @return The number of characters copied to the buffer.
+     * @throws OhioException
+     */
+    public synchronized int GetScreen(char buffer[], int bufferLength, int row,
+                                        int col, int length, int plane)
+ //                                       throws OhioException {
+                                        {
+       // Call GetScreen function after converting row and column to
+       // a position.
+       return planes.GetScreen(buffer,bufferLength, row, col, length, plane);
+    }
+ 
+    /**
+     * <p>
+     *  GetScreenRect retrieves data from the various planes associated with the
+     *  presentation space. The data is returned as a linear array of character
+     *  values in the buffer provided.
+     *  </p>
+     *
+     * <p>
+     * The application supplies two positions that represent opposing corners of
+     * a rectangle within the presentation space. The starting and ending
+     * positions can have any spatial relationship to each other. The data
+     * returned starts from the row containing the upper-most point to the row
+     * containing the lower-most point, and from the left-most column to the
+     * right-most column.
+     * </p>
+     * <p>
+     * The specified buffer must be at least large enough to contain the number
+     * of characters in the rectangle. If the buffer is too small, no data is
+     * copied and zero is returned by the method. Otherwise, the method returns
+     * the number of characters copied.
+     * </p>
+     *
+     * @param buffer
+     * @param bufferLength
+     * @param startPos
+     * @param endPos
+     * @param plane
+     * @return The number of characters copied to the buffer
+     * @throws OhioException
+     */
+    public synchronized int GetScreenRect(char buffer[], int bufferLength,
+                                              int startPos, int endPos, int plane)
+ //                                             throws OhioException {
+                                              {
+       return planes.GetScreenRect(buffer, bufferLength, startPos, endPos, plane);
+ 
+    }
+ 
+    /**
+     * <p>
+     *  GetScreenRect retrieves data from the various planes associated with the
+     *  presentation space. The data is returned as a linear array of character
+     *  values in the buffer provided. The buffer is not terminated by a null
+     *  character.
+     * </p>
+     * <p>
+     * The application supplies two coordinates that represent opposing corners
+     * of a rectangle within the presentation space. The starting and ending
+     * coordinates can have any spatial relationship to each other. The data
+     * returned starts from the row containing the upper-most point to the row
+     * containing the lower-most point, and from the left-most column to the
+     * right-most column.
+     * </p>
+     * <p>
+     * The specified buffer must be at least large enough to contain the number
+     * of characters in the rectangle. If the buffer is too small, no data is
+     * copied and zero is returned by the method. Otherwise, the method returns
+     * the number of characters copied.
+     * </p>
+     *
+     * @param buffer
+     * @param bufferLength
+     * @param startRow
+     * @param startCol
+     * @param endRow
+     * @param endCol
+     * @param plane
+     * @return The number characters copied to the buffer
+     * @throws OhioException
+     */
+    public synchronized int GetScreenRect(char buffer[], int bufferLength,
+                                              int startRow, int startCol,
+                                              int endRow, int endCol, int plane)
+ //                                             throws OhioException {
+                                              {
+ 
+       return planes.GetScreenRect(buffer, bufferLength, startRow, startCol, endRow,
+                                     endCol, plane);
+    }
+ 
  	/**
  	 * This routine is based on offset 1,1 not 0,0 it will translate to offset
***************
*** 4241,4250 ****
  	public boolean checkHotSpots() {
  
! 		boolean retHS = false;
        // needs to be re implemented
  //		retHS = GUIHotSpots.checkHotSpots(this, screen, numRows, numCols,
  //				lenScreen, fmWidth, fmHeight);
  
! 		return retHS;
  	}
  
--- 4417,4427 ----
  	public boolean checkHotSpots() {
  
! //		boolean retHS = false;
        // needs to be re implemented
  //		retHS = GUIHotSpots.checkHotSpots(this, screen, numRows, numCols,
  //				lenScreen, fmWidth, fmHeight);
  
! //		return retHS;
! 	   return planes.checkHotSpots();
  	}
  
***************
*** 4546,4550 ****
  		if (planes.isErrorLineSaved()) {
           planes.restoreErrorLine();
! //			updateImage(0, screen[r].y, bi.getWidth(), fmHeight);
  		}
  	}
--- 4723,4728 ----
  		if (planes.isErrorLineSaved()) {
           planes.restoreErrorLine();
!          int y = fmHeight * planes.getErrorLine();
! 			updateImage(0, y, bi.getWidth(), fmHeight);
  		}
  	}



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com