tn5250j/src/org/tn5250j PrinterThread.java,1.8,1.9 Screen5250.java,1.42,1.43 ScreenChar.java,1.9,1.10 tnvt.java,1.37,1.38

[email protected]
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1:/tmp/cvs-serv2799/src/org/tn5250j

Modified Files:
	PrinterThread.java Screen5250.java ScreenChar.java tnvt.java 
Log Message:
Printing related updates

Index: PrinterThread.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/PrinterThread.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PrinterThread.java	11 Dec 2003 07:00:47 -0000	1.8
--- PrinterThread.java	11 Dec 2003 07:25:25 -0000	1.9
***************
*** 1,252 ****
! package org.tn5250j;
! /**
!  * Title: PrinterThread
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! import java.awt.print.*;
! import java.awt.*;
! import java.awt.font.*;
! import org.tn5250j.Session;
! import org.tn5250j.SessionConfig;
! 
! public class PrinterThread extends Thread implements Printable {
! 
!    ScreenChar[] screen;
!    int numCols;
!    int numRows;
!    Color colorBg;
!    Font font;
!    Session session;
!    boolean toDefault;
!    SessionConfig config;
! 
!    public PrinterThread (ScreenChar[] sc, Font font, int cols, int rows,
!                            Color colorBg, boolean toDefaultPrinter, Session ses) {
! 
! 
!       setPriority(1);
!       session = ses;
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
!       config = ses.getConfiguration();
! 
!       screen = new ScreenChar[sc.length];
!       toDefault = toDefaultPrinter;
! 
!       int len = sc.length;
! 
!       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;
!       this.colorBg = colorBg;
!       this.font = font;
!    }
! 
!    public void run () {
! // Toolkit tk = Toolkit.getDefaultToolkit();
! //int [][] range = new int[][] {
! //new int[] { 1, 1 }
! //};
! // JobAttributes jobAttributes = new JobAttributes(1, JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER, JobAttributes.DialogType.NONE, "file", 1, 1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES, range, "HP LaserJet", JobAttributes.SidesType.ONE_SIDED);
! //PrintJob job = tk.getPrintJob(null, "Print", jobAttributes, null);
! //if (job != null) {
!       //--- Create a printerJob object
!       PrinterJob printJob = PrinterJob.getPrinterJob ();
!       printJob.setJobName("tn5250j");
! 
!       // will have to remember this for the next time.
!       //   Always set a page format before call setPrintable to
!       //   set the orientation.
!       PageFormat pf = printJob.defaultPage();
!       if (numCols == 132)
!          pf.setOrientation(PageFormat.LANDSCAPE);
!       else
!          pf.setOrientation(PageFormat.PORTRAIT);
! 
!       // set the margins
!       final double MM_TO_PAPER_UNITS = 1/25.4*72;
!       Paper paper = pf.getPaper();
!       double widthA4 = 210*MM_TO_PAPER_UNITS;
!       double heightA4 = 297*MM_TO_PAPER_UNITS;
!       paper.setSize(widthA4,heightA4);
! 
!       double leftMargin = 4.0*MM_TO_PAPER_UNITS;
!       double topMargin = 10.0*MM_TO_PAPER_UNITS;
!       double rightMargin = 4.0*MM_TO_PAPER_UNITS;
!       double bottomMargin = 15.0*MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("leftMargin") > 0)
!          leftMargin = config.getFloatProperty("leftMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("rightMargin") > 0)
!          rightMargin = config.getFloatProperty("rightMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("topMargin") > 0)
!          topMargin = config.getFloatProperty("topMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("bottomMargin") > 0)
!          bottomMargin = config.getFloatProperty("bottomMargin") * MM_TO_PAPER_UNITS;
! 
!       paper.setImageableArea(leftMargin,topMargin,paper.getWidth()-leftMargin-rightMargin,paper.getHeight()-topMargin-bottomMargin);
! 
!       pf.setPaper(paper);
! 
!       //--- Set the printable class to this one since we
!       //--- are implementing the Printable interface
!       printJob.setPrintable (this,pf);
! 
!       // set the cursor back
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
! 
! 
!       //--- Show a print dialog to the user. If the user
!       //--- clicks the print button, then print, otherwise
!       //--- cancel the print job
!       if (printJob.printDialog()) {
!          try {
!             // we do this because of loosing focus with jdk 1.4.0
!             session.requestFocus();
!             printJob.print();
!          } catch (Exception PrintException) {
!             PrintException.printStackTrace();
!          }
!       }
!       else {
!          // we do this because of loosing focus with jdk 1.4.0
!          session.requestFocus();
!       }
! 
!       session = null;
! 
!       int len = screen.length;
! 
!       for (int x = 0; x < len; x++) {
!          screen[x] = null;
!       }
! 
!       screen = null;
! 
!    }
! 
!    /**
!      * Method: print <p>
!      *
!      * This routine is responsible for rendering a page using
!      * the provided parameters. The result will be a screen
!      * print of the current screen to the printer graphics object
!      *
!      * @param g a value of type Graphics
!      * @param pageFormat a value of type PageFormat
!      * @param page a value of type int
!      * @return a value of type int
!      */
!    public int print (Graphics g, PageFormat pageFormat, int page) {
! 
!       Graphics2D g2;
! 
!       //--- Validate the page number, we only print the first page
!       if (page == 0) {
! 
!          //--- Create a graphic2D object and set the default parameters
!          g2 = (Graphics2D) g;
!          g2.setColor (Color.black);
! 
!          //--- Translate the origin to be (0,0)
!          g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ());
! 
!          int w = (int)pageFormat.getImageableWidth() / numCols;     // proposed width
!          int h = (int)pageFormat.getImageableHeight() / numRows;     // proposed height
! 
!          Font k = new Font("Courier New",Font.PLAIN,8);
! 
!          LineMetrics l;
!          FontRenderContext f = null;
! 
!          float j = 1;
! 
!          for (; j < 36; j++) {
! 
!             // derive the font and obtain the relevent information to compute
!             // the width and height
!             k = font.deriveFont(j);
!             f = new FontRenderContext(k.getTransform(),true,true);
!             l = k.getLineMetrics("Wy",f);
! 
!             if (
!                   (w < (int)k.getStringBounds("W",f).getWidth()) ||
!                      h < (int)(k.getStringBounds("g",f).getHeight() +
!                            l.getDescent() + l.getLeading())
! 
!                )
!                break;
!          }
! 
!          // since we were looking for an overrun of the width or height we need
!          // to adjust the font one down to get the last one that fit.
!          k = font.deriveFont(--j);
!          f = new FontRenderContext(k.getTransform(),true,true);
!          l = k.getLineMetrics("Wy",f);
! 
!          // set the font of the print job
!          g2.setFont(k);
! 
!          // get the width and height of the character bounds
!          int w1 = (int)k.getStringBounds("W",f).getWidth();
!          int h1 = (int)(k.getStringBounds("g",f).getHeight() +
!                      l.getDescent() + l.getLeading());
!          int x;
!          int y;
! 
!          // loop through all the screen characters and print them out.
!          for (int m = 0;m < numRows; m++)
!             for (int i = 0; i < numCols; i++) {
!                x = w1 * i;
!                y = h1 * (m + 1);
! 
!                // only draw printable characters (in this case >= ' ')
!                if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) {
! 
!                   g2.drawChars(screen[getPos(m,i)].sChar, 0, 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)
!                   g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
! 
!             }
! 
!          return (PAGE_EXISTS);
!       }
!       else
!          return (NO_SUCH_PAGE);
!    }
! 
!    private int getPos(int row, int col) {
! 
!       return (row * numCols) + col;
!    }
  }
--- 1,252 ----
! package org.tn5250j;
! /**
!  * Title: PrinterThread
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! import java.awt.print.*;
! import java.awt.*;
! import java.awt.font.*;
! import org.tn5250j.Session;
! import org.tn5250j.SessionConfig;
! 
! public class PrinterThread extends Thread implements Printable {
! 
!    ScreenChar[] screen;
!    int numCols;
!    int numRows;
!    Color colorBg;
!    Font font;
!    Session session;
!    boolean toDefault;
!    SessionConfig config;
! 
!    public PrinterThread (ScreenChar[] sc, Font font, int cols, int rows,
!                            Color colorBg, boolean toDefaultPrinter, Session ses) {
! 
! 
!       setPriority(1);
!       session = ses;
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
!       config = ses.getConfiguration();
! 
!       screen = new ScreenChar[sc.length];
!       toDefault = toDefaultPrinter;
! 
!       int len = sc.length;
! 
!       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;
!       this.colorBg = colorBg;
!       this.font = font;
!    }
! 
!    public void run () {
! // Toolkit tk = Toolkit.getDefaultToolkit();
! //int [][] range = new int[][] {
! //new int[] { 1, 1 }
! //};
! // JobAttributes jobAttributes = new JobAttributes(1, JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER, JobAttributes.DialogType.NONE, "file", 1, 1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES, range, "HP LaserJet", JobAttributes.SidesType.ONE_SIDED);
! //PrintJob job = tk.getPrintJob(null, "Print", jobAttributes, null);
! //if (job != null) {
!       //--- Create a printerJob object
!       PrinterJob printJob = PrinterJob.getPrinterJob ();
!       printJob.setJobName("tn5250j");
! 
!       // will have to remember this for the next time.
!       //   Always set a page format before call setPrintable to
!       //   set the orientation.
!       PageFormat pf = printJob.defaultPage();
!       if (numCols == 132)
!          pf.setOrientation(PageFormat.LANDSCAPE);
!       else
!          pf.setOrientation(PageFormat.PORTRAIT);
! 
!       // set the margins
!       final double MM_TO_PAPER_UNITS = 1/25.4*72;
!       Paper paper = pf.getPaper();
!       double widthA4 = 210*MM_TO_PAPER_UNITS;
!       double heightA4 = 297*MM_TO_PAPER_UNITS;
!       paper.setSize(widthA4,heightA4);
! 
!       double leftMargin = 4.0*MM_TO_PAPER_UNITS;
!       double topMargin = 10.0*MM_TO_PAPER_UNITS;
!       double rightMargin = 4.0*MM_TO_PAPER_UNITS;
!       double bottomMargin = 15.0*MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("leftMargin") > 0)
!          leftMargin = config.getFloatProperty("leftMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("rightMargin") > 0)
!          rightMargin = config.getFloatProperty("rightMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("topMargin") > 0)
!          topMargin = config.getFloatProperty("topMargin") * MM_TO_PAPER_UNITS;
! 
!       if (config.getFloatProperty("bottomMargin") > 0)
!          bottomMargin = config.getFloatProperty("bottomMargin") * MM_TO_PAPER_UNITS;
! 
!       paper.setImageableArea(leftMargin,topMargin,paper.getWidth()-leftMargin-rightMargin,paper.getHeight()-topMargin-bottomMargin);
! 
!       pf.setPaper(paper);
! 
!       //--- Set the printable class to this one since we
!       //--- are implementing the Printable interface
!       printJob.setPrintable (this,pf);
! 
!       // set the cursor back
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
! 
! 
!       //--- Show a print dialog to the user. If the user
!       //--- clicks the print button, then print, otherwise
!       //--- cancel the print job
!       if (printJob.printDialog()) {
!          try {
!             // we do this because of loosing focus with jdk 1.4.0
!             session.requestFocus();
!             printJob.print();
!          } catch (Exception PrintException) {
!             PrintException.printStackTrace();
!          }
!       }
!       else {
!          // we do this because of loosing focus with jdk 1.4.0
!          session.requestFocus();
!       }
! 
!       session = null;
! 
!       int len = screen.length;
! 
!       for (int x = 0; x < len; x++) {
!          screen[x] = null;
!       }
! 
!       screen = null;
! 
!    }
! 
!    /**
!      * Method: print <p>
!      *
!      * This routine is responsible for rendering a page using
!      * the provided parameters. The result will be a screen
!      * print of the current screen to the printer graphics object
!      *
!      * @param g a value of type Graphics
!      * @param pageFormat a value of type PageFormat
!      * @param page a value of type int
!      * @return a value of type int
!      */
!    public int print (Graphics g, PageFormat pageFormat, int page) {
! 
!       Graphics2D g2;
! 
!       //--- Validate the page number, we only print the first page
!       if (page == 0) {
! 
!          //--- Create a graphic2D object and set the default parameters
!          g2 = (Graphics2D) g;
!          g2.setColor (Color.black);
! 
!          //--- Translate the origin to be (0,0)
!          g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ());
! 
!          int w = (int)pageFormat.getImageableWidth() / numCols;     // proposed width
!          int h = (int)pageFormat.getImageableHeight() / numRows;     // proposed height
! 
!          Font k = new Font("Courier New",Font.PLAIN,8);
! 
!          LineMetrics l;
!          FontRenderContext f = null;
! 
!          float j = 1;
! 
!          for (; j < 36; j++) {
! 
!             // derive the font and obtain the relevent information to compute
!             // the width and height
!             k = font.deriveFont(j);
!             f = new FontRenderContext(k.getTransform(),true,true);
!             l = k.getLineMetrics("Wy",f);
! 
!             if (
!                   (w < (int)k.getStringBounds("W",f).getWidth()) ||
!                      h < (int)(k.getStringBounds("g",f).getHeight() +
!                            l.getDescent() + l.getLeading())
! 
!                )
!                break;
!          }
! 
!          // since we were looking for an overrun of the width or height we need
!          // to adjust the font one down to get the last one that fit.
!          k = font.deriveFont(--j);
!          f = new FontRenderContext(k.getTransform(),true,true);
!          l = k.getLineMetrics("Wy",f);
! 
!          // set the font of the print job
!          g2.setFont(k);
! 
!          // get the width and height of the character bounds
!          int w1 = (int)k.getStringBounds("W",f).getWidth();
!          int h1 = (int)(k.getStringBounds("g",f).getHeight() +
!                      l.getDescent() + l.getLeading());
!          int x;
!          int y;
! 
!          // loop through all the screen characters and print them out.
!          for (int m = 0;m < numRows; m++)
!             for (int i = 0; i < numCols; i++) {
!                x = w1 * i;
!                y = h1 * (m + 1);
! 
!                // only draw printable characters (in this case >= ' ')
!                if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) {
! 
!                   g2.drawChars(screen[getPos(m,i)].sChar, 0, 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)
!                   g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
! 
!             }
! 
!          return (PAGE_EXISTS);
!       }
!       else
!          return (NO_SUCH_PAGE);
!    }
! 
!    private int getPos(int row, int col) {
! 
!       return (row * numCols) + col;
!    }
  }

Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** Screen5250.java	6 Dec 2003 08:16:11 -0000	1.42
--- Screen5250.java	11 Dec 2003 07:25:25 -0000	1.43
***************
*** 3403,3406 ****
--- 3403,3407 ----
                 screen[lastPos-1].setUseGUI(ScreenChar.FIELD_ONE);
  
+ //         screen[lastPos].setCharAndAttr(initChar,initAttr,true);
           setEndingAttr(initAttr);
  
***************
*** 3628,3632 ****
  
        if (cByte > 0 && cByte < ' ') {
!          screen[lastPos].setCharAndAttr(' ',33,false);
           setDirty(lastPos);
  
--- 3629,3633 ----
  
        if (cByte > 0 && cByte < ' ') {
!          screen[lastPos].setCharAndAttr((char)0x00,33,false);
           setDirty(lastPos);
  
***************
*** 3635,3643 ****
        else {
           if (lastPos > 0) {
!             if (screen[lastPos - 1].isAttributePlace())
!                lastAttr = screen[lastPos -1].getCharAttr();
           }
  
!          screen[lastPos].setCharAndAttr((char)cByte,lastAttr,false);
           setDirty(lastPos);
           if (guiInterface && !isInField(lastPos,false))
--- 3636,3646 ----
        else {
           if (lastPos > 0) {
!              if (screen[lastPos - 1].isAttributePlace())// &&
!                 lastAttr = screen[lastPos -1].getCharAttr();
           }
  
!          screen[lastPos].setCharAndAttr((char)cByte,
!                            screen[lastPos].getCharAttr(),false);
! 
           setDirty(lastPos);
           if (guiInterface && !isInField(lastPos,false))
***************
*** 3664,3670 ****
        lastAttr = cByte;
  
! //      int sattr = screen[getPos(lastRow,lastCol)].getCharAttr();
  //         System.out.println("changing from " + sattr + " to attr " + lastAttr +
! //                     " at " + (lastRow + 1) + "," + (lastCol + 1));
        screen[lastPos].setCharAndAttr(initChar,lastAttr,true);
        setDirty(lastPos);
--- 3667,3673 ----
        lastAttr = cByte;
  
! //      int sattr = screen[lastPos].getCharAttr();
  //         System.out.println("changing from " + sattr + " to attr " + lastAttr +
! //                     " at " + (this.getRow(lastPos) + 1) + "," + (this.getCol(lastPos) + 1));
        screen[lastPos].setCharAndAttr(initChar,lastAttr,true);
        setDirty(lastPos);
***************
*** 3674,3677 ****
--- 3677,3684 ----
  
        int times = 0;
+ //      sattr = screen[lastPos].getCharAttr();
+ //         System.out.println(" next position after change " + sattr + " last attr " + lastAttr +
+ //                     " at " + (this.getRow(lastPos) + 1) + "," + (this.getCol(lastPos) + 1) +
+ //                     " attr place " + screen[lastPos].isAttributePlace());
        while (screen[lastPos].getCharAttr() != lastAttr &&
              !screen[lastPos].isAttributePlace()) {

Index: ScreenChar.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/ScreenChar.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ScreenChar.java	25 Nov 2003 15:10:10 -0000	1.9
--- ScreenChar.java	11 Dec 2003 07:25:25 -0000	1.10
***************
*** 56,60 ****
  
     public final boolean isAttributePlace() {
- //      return (attributePlace || (sChar[0] == ' ' && !underLine && !colSep && bg.equals(s.colorBg)));
        return attributePlace;
     }
--- 56,59 ----
***************
*** 304,307 ****
--- 303,307 ----
  
        if (attributePlace && s.isShowHex()) {
+ //      if ((sChar[0] == 0x20 || sChar[0] == 0x0 || nonDisplay) && s.isShowHex()) {
           Font f = g.getFont();
  
***************
*** 314,317 ****
--- 314,318 ----
              (int)(y + s.fmHeight - (s.lm.getDescent() + s.lm.getLeading())-2));
           g.setFont(f);
+ //return;
        }
  

Index: tnvt.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tnvt.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** tnvt.java	11 Nov 2003 13:39:58 -0000	1.37
--- tnvt.java	11 Dec 2003 07:25:25 -0000	1.38
***************
*** 1144,1147 ****
--- 1144,1148 ----
          throws IOException  {
  
+ 
        ByteArrayOutputStream sc = new ByteArrayOutputStream();
        sc.write(4);
***************
*** 1199,1205 ****
        }
  
!       screen52.getScreenFields().setCurrentField(null);    // set it to null for GC ?
  
-       screen52.clearTable();
        try {
           writeGDS(0, 3, sc.toByteArray());
--- 1200,1208 ----
        }
  
!       // The following two lines of code looks to have caused all sorts of
!       //    problems so for now we have commented them out.
! //      screen52.getScreenFields().setCurrentField(null);    // set it to null for GC ?
! //      screen52.clearTable();
  
        try {
           writeGDS(0, 3, sc.toByteArray());
***************
*** 1799,1802 ****
--- 1802,1813 ----
           bk.getNextByte(); // reserved
           bk.getNextByte(); // resequence fields
+ 
+          screen52.clearTable();
+ 
+          // well that is the first time I have seen this.  This fixes a problem
+          // with S/36 command line.  Finally got it.
+          if (l <=3)
+             return false;
+ 
           screen52.setErrorLine(bk.getNextByte()); // error row
  
***************
*** 1845,1849 ****
  //            System.out.println(" byte 7 " + Integer.toBinaryString(bk.getNextByte()));
  
-          screen52.clearTable();
           return false;
        }
--- 1856,1859 ----
***************
*** 2035,2043 ****
  
                    switch (bk.getNextByte()) {
! //                     case 0x50:      // Define Selection Field
! //
! //                        defineSelectionField(length);
! //                        done = true;
! //                        break;
                       case 0x51:      // Create Window
  
--- 2045,2053 ----
  
                    switch (bk.getNextByte()) {
!                      case 0x50:      // Define Selection Field
! 
!                         defineSelectionField(length);
!                         done = true;
!                         break;
                       case 0x51:      // Create Window
  
***************
*** 2393,2397 ****
           int rows = bk.getNextByte();    // Rows - byte 15
  
!          int maxColChoice = bk.getNextByte();    // byte 16
           int padding = bk.getNextByte();    // byte 17
           int numSepChar = bk.getNextByte();    // byte 18
--- 2403,2407 ----
           int rows = bk.getNextByte();    // Rows - byte 15
  
!          int maxColChoice = bk.getNextByte();    // byte 16 num of column choices
           int padding = bk.getNextByte();    // byte 17
           int numSepChar = bk.getNextByte();    // byte 18
***************
*** 2406,2412 ****
                                + " type " + typeSelection
                                + " gui " + guiDevice
!                               + "withMnemonic " + withMnemonic
                                + " cols " + cols
                                + " rows " + rows);
           do {
              minLen = bk.getNextByte();    // Minor Length byte 21
--- 2416,2428 ----
                                + " type " + typeSelection
                                + " gui " + guiDevice
!                               + " withMnemonic " + withMnemonic
                                + " cols " + cols
                                + " rows " + rows);
+          int rowCtr = 0;
+          int chcRowStart = screen52.getCurrentRow();
+          int chcColStart = screen52.getCurrentCol();
+          int colAvail = 0x20;
+          int colSelAvail = 0x20;
+          int fld = 0;
           do {
              minLen = bk.getNextByte();    // Minor Length byte 21
***************
*** 2422,2426 ****
  
                    bk.getNextByte(); // mon select cursor avail emphasis - byte4
!                   int colSelAvail = bk.getNextByte();  // -byte 5
  
                    bk.getNextByte(); // mon select cursor - byte 6
--- 2438,2442 ----
  
                    bk.getNextByte(); // mon select cursor avail emphasis - byte4
!                   colSelAvail = bk.getNextByte();  // -byte 5
  
                    bk.getNextByte(); // mon select cursor - byte 6
***************
*** 2431,2435 ****
  
                    bk.getNextByte(); // mon avail emphasis - byte 10
!                   int colAvail = bk.getNextByte();  // -byte 11
  
                    bk.getNextByte(); // mon select emphasis - byte 12
--- 2447,2451 ----
  
                    bk.getNextByte(); // mon avail emphasis - byte 10
!                   colAvail = bk.getNextByte();  // -byte 11
  
                    bk.getNextByte(); // mon select emphasis - byte 12
***************
*** 2449,2452 ****
--- 2465,2469 ----
                 case 0x10:  // Choice Text minor structure
  
+                   screen52.goto_XY(chcRowStart++,chcColStart);
                    cnt = 5;
                    int flagCT1 = bk.getNextByte();
***************
*** 2455,2458 ****
--- 2472,2482 ----
                    int mnemOffset = 0;
                    boolean aid = false;
+                   boolean selected = false;
+ 
+                   // is mnemonic offset specified
+                   if ((flagCT1 & 0x40) == 0x40) {
+                      System.out.println(" selected ");
+                      selected = true;
+                   }
  
                    // is mnemonic offset specified
***************
*** 2488,2491 ****
--- 2512,2519 ----
                    String s = "";
                    byte byte0 = 0;
+ //                  if (fld++ == 2)
+ //                  screen52.addField(colAvail,cols,0x0,0,0,0);
+ //                  else
+                   screen52.addField(colAvail,cols,0x20,0,0,0);
                    for (;cnt < minLen; cnt++) {
  
***************
*** 2495,2499 ****
  
                    }
!                   System.out.println(s);
                    break;
                 default:
--- 2523,2527 ----
  
                    }
!                   System.out.println(s + " selected " + selected);
                    break;
                 default:




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.