tn5250j/src/org/tn5250j GuiGraphicBuffer.java,1.27,1.28 Screen5250.java,1.72,1.73 PrinterThread.java,1.11,1.12

"Kenneth J. Pouncey" <[email protected]> Mon, 12 Jul 2004 04:45:58 +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-serv1513/src/org/tn5250j

Modified Files:
	GuiGraphicBuffer.java Screen5250.java PrinterThread.java 
Log Message:
Fixed printer thread to use planes and detect underline now

Index: PrinterThread.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/PrinterThread.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PrinterThread.java	9 Jul 2004 04:33:59 -0000	1.11
--- PrinterThread.java	12 Jul 2004 04:45:56 -0000	1.12
***************
*** 1,3 ****
- package org.tn5250j;
  /**
   * Title: PrinterThread
--- 1,2 ----
***************
*** 25,28 ****
--- 24,29 ----
   *
   */
+ package org.tn5250j;
+ 
  import java.awt.print.*;
  import java.awt.*;
***************
*** 31,37 ****
  import org.tn5250j.SessionConfig;
  
! public class PrinterThread extends Thread implements Printable {
  
     char[] screen;
     int numCols;
     int numRows;
--- 32,41 ----
  import org.tn5250j.SessionConfig;
  
! public class PrinterThread extends Thread implements Printable, TN5250jConstants {
  
     char[] screen;
+    char[] screenAttr;
+    char[] screenAttrPlace;
+    Screen5250 scr;
     int numCols;
     int numRows;
***************
*** 42,46 ****
     SessionConfig config;
  
!    public PrinterThread (char[] sc, Font font, int cols, int rows,
                             Color colorBg, boolean toDefaultPrinter, Session ses) {
  
--- 46,50 ----
     SessionConfig config;
  
!    public PrinterThread (Screen5250 scr, Font font, int cols, int rows,
                             Color colorBg, boolean toDefaultPrinter, Session ses) {
  
***************
*** 50,66 ****
        session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        config = ses.getConfiguration();
! 
!       screen = new char[sc.length];
! 		System.arraycopy(sc, 0, screen, 0, sc.length);
        toDefault = toDefaultPrinter;
  
-       int len = sc.length;
- 
-       // we need to fix this to use the access methods to planes
- //      for (int x = 0; x < len; x++) {
- //         screen[x] = new ScreenChar(sc[x].s);
- //         screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());
- //      }
- 
        numCols = cols;
        numRows = rows;
--- 54,64 ----
        session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        config = ses.getConfiguration();
!       int len = scr.getScreenLength();
!       screen = new char[len];
!       screenAttr = new char[len];
!       int ret = scr.GetScreen(screen, len, PLANE_TEXT);
!       ret = scr.GetScreen(screenAttr, len, PLANE_EXTENDED);
        toDefault = toDefaultPrinter;
  
        numCols = cols;
        numRows = rows;
***************
*** 169,179 ****
        session = null;
  
! //      int len = screen.length;
! //
! //      for (int x = 0; x < len; x++) {
! //         screen[x] = null;
! //      }
! //
! //      screen = null;
  
     }
--- 167,172 ----
        session = null;
  
!       screen = null;
!       screenAttr = null;
  
     }
***************
*** 255,271 ****
  
                 // only draw printable characters (in this case >= ' ')
! //               if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) {
!                //  TODO:  Fix me for detecting non display
!                if (screen[getPos(m,i)] >= ' ') {  // && !screen[getPos(m,i)].nonDisplay) {
  
- //                  g2.drawChars(screen[getPos(m,i)], 0, 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2));
                    g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2));
  
                 }
  
-                //  TODO:  Fix me for detecting non display
                 // if it is underlined then underline the character
  //               if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)
! //                  g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
  
              }
--- 248,261 ----
  
                 // only draw printable characters (in this case >= ' ')
!                if (screen[getPos(m,i)] >= ' ' && ((screen[getPos(m,i)] & EXTENDED_5250_NON_DSP) == 0)) {
  
                    g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2));
  
                 }
  
                 // if it is underlined then underline the character
  //               if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)
!                if ((screenAttr[getPos(m,i)] & EXTENDED_5250_UNDERLINE) == 1)
!                   g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
  
              }

Index: GuiGraphicBuffer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** GuiGraphicBuffer.java	12 Jul 2004 04:22:02 -0000	1.27
--- GuiGraphicBuffer.java	12 Jul 2004 04:45:56 -0000	1.28
***************
*** 779,788 ****
        ScreenPlanes planes = s.planes;
  
- //      int attr = planes.getCharAttr(pos);
        int attr = updateRect.attr[pos];
        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;
--- 779,786 ----
***************
*** 795,802 ****
        int cy = (int)(y + rowHeight - (s.lm.getDescent() + s.lm.getLeading()));
  
- //      int x = sc.x;
- //      int y = sc.y;
- //      int cy = sc.cy;
- 
        if (attributePlace && s.isShowHex()) {
  //      if ((sc.sChar[0] == 0x20 || sc.sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
--- 793,796 ----
***************
*** 811,815 ****
              (int)(y + rowHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
           g.setFont(f);
- //return;
        }
  
--- 805,808 ----

Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** Screen5250.java	12 Jul 2004 04:22:02 -0000	1.72
--- Screen5250.java	12 Jul 2004 04:45:56 -0000	1.73
***************
*** 5249,5253 ****
  	public final void printMe() {
  
! 		Thread printerThread = new PrinterThread(planes.screen, font, numCols,
  				numRows, colorBg, defaultPrinter, (Session) gui);
  
--- 5249,5253 ----
  	public final void printMe() {
  
! 		Thread printerThread = new PrinterThread(this, font, numCols,
  				numRows, colorBg, defaultPrinter, (Session) gui);
  



-------------------------------------------------------
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