tn5250j/src/org/tn5250j GuiGraphicBuffer.java,1.20,1.21 Screen5250.java,1.66,1.67

"Kenneth J. Pouncey" <[email protected]> Tue, 06 Jul 2004 06:26:17 +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-serv27700/src/org/tn5250j

Modified Files:
	GuiGraphicBuffer.java Screen5250.java 
Log Message:
Took the cursor painting out of the screen and moved it to graphics buffer

Index: GuiGraphicBuffer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** GuiGraphicBuffer.java	5 Jul 2004 18:59:08 -0000	1.20
--- GuiGraphicBuffer.java	6 Jul 2004 06:26:14 -0000	1.21
***************
*** 185,202 ****
  
  
!    public void drawCursor(Screen5250 s,int row, int col,
!                            int fmWidth, int fmHeight,
!                            boolean insertMode, int crossHair,
!                            boolean rulerFixed,
!                            int cursorSize, Color colorCursor,
!                            Color colorBg,Color colorWhite,
!                            Font font,int botOffset) {
  
           Graphics2D g2 = getDrawingArea();
  
!          switch (cursorSize) {
              case 0:
                 cursor.setRect(
!                            fmWidth * (col),
                             (fmHeight * (row + 1)) - botOffset,
                             fmWidth,
--- 185,214 ----
  
  
!    public void drawCursor()   {
! //      public void drawCursor(int row, int col)   {
! //                           int fmWidth, int fmHeight,
! //                           boolean insertMode, int crossHair,
! //                           boolean rulerFixed,
! //                           int cursorSize, Color colorCursor,
! //                           Color colorBg,Color colorWhite,
! //                           Font font,int botOffset) {
  
+       	int row = screen.getRow(screen.getLastPos());
+       	int col = screen.getCol(screen.getLastPos());
+       	
+       	int fmHeight = screen.fmHeight;
+       	int fmWidth = screen.fmWidth;
+       	int botOffset = screen.cursorBottOffset;
+       	int cursorSize = screen.cursorSize;
+       	boolean insertMode = screen.insertMode;
+       	boolean rulerFixed = screen.rulerFixed;
+       	int crossHair = screen.crossHair;
+       	
           Graphics2D g2 = getDrawingArea();
  
!          switch (screen.cursorSize) {
              case 0:
                 cursor.setRect(
!                      fmWidth * (col),
                             (fmHeight * (row + 1)) - botOffset,
                             fmWidth,
***************
*** 206,210 ****
              case 1:
                 cursor.setRect(
!                            fmWidth * (col),
                             (fmHeight * (row + 1) - fmHeight / 2),
                             fmWidth,
--- 218,222 ----
              case 1:
                 cursor.setRect(
!                      fmWidth * (col),
                             (fmHeight * (row + 1) - fmHeight / 2),
                             fmWidth,
***************
*** 214,218 ****
              case 2:
                 cursor.setRect(
!                            fmWidth * (col),
                             (fmHeight * row),
                             fmWidth,
--- 226,230 ----
              case 2:
                 cursor.setRect(
!                      fmWidth * (col),
                             (fmHeight * row),
                             fmWidth,
***************
*** 224,228 ****
           if (insertMode && cursorSize != 1) {
                 cursor.setRect(
!                            fmWidth * (col),
                             (fmHeight * (row + 1) - fmHeight / 2),
                             fmWidth,
--- 236,240 ----
           if (insertMode && cursorSize != 1) {
                 cursor.setRect(
!                      fmWidth * (col),
                             (fmHeight * (row + 1) - fmHeight / 2),
                             fmWidth,
***************
*** 234,243 ****
           r.setSize(r.width,r.height);
  
!          g2.setColor(colorCursor);
!          g2.setXORMode(colorBg);
  
           g2.fill(cursor);
  
!          s.updateImage(r);
  
           if (!rulerFixed) {
--- 246,255 ----
           r.setSize(r.width,r.height);
  
!          g2.setColor(screen.colorCursor);
!          g2.setXORMode(screen.colorBg);
  
           g2.fill(cursor);
  
!          screen.updateImage(r);
  
           if (!rulerFixed) {
***************
*** 259,268 ****
                             bi.getWidth(null),
                             (fmHeight * (crossRow + 1))- botOffset);
!                s.updateImage(0,fmHeight * (crossRow + 1)- botOffset,
                                bi.getWidth(null),1);
                 break;
              case 2:  // vertical
                 g2.drawLine(crossRect.x,0,crossRect.x,bi.getHeight(null) - fmHeight - fmHeight);
!                s.updateImage(crossRect.x,0,1,bi.getHeight(null) - fmHeight - fmHeight);
                 break;
  
--- 271,280 ----
                             bi.getWidth(null),
                             (fmHeight * (crossRow + 1))- botOffset);
!                screen.updateImage(0,fmHeight * (crossRow + 1)- botOffset,
                                bi.getWidth(null),1);
                 break;
              case 2:  // vertical
                 g2.drawLine(crossRect.x,0,crossRect.x,bi.getHeight(null) - fmHeight - fmHeight);
!                screen.updateImage(crossRect.x,0,1,bi.getHeight(null) - fmHeight - fmHeight);
                 break;
  
***************
*** 272,292 ****
                             (fmHeight * (crossRow + 1))- botOffset);
                 g2.drawLine(crossRect.x,0,crossRect.x,bi.getHeight(null) - fmHeight - fmHeight);
!                s.updateImage(0,fmHeight * (crossRow + 1)- botOffset,
                                bi.getWidth(null),1);
!                s.updateImage(crossRect.x,0,1,bi.getHeight(null) - fmHeight - fmHeight);
                 break;
           }
  
           g2.dispose();
!          g2 = getWritingArea(font);
!          g2.setPaint(colorBg);
  
           g2.fill(pArea);
!          g2.setColor(colorWhite);
  
           g2.drawString((row + 1) + "/" + (col + 1)
                          ,(float)pArea.getX(),
                          (float)pArea.getY() + fmHeight);
!          s.updateImage(pArea.getBounds());
           g2.dispose();
  
--- 284,304 ----
                             (fmHeight * (crossRow + 1))- botOffset);
                 g2.drawLine(crossRect.x,0,crossRect.x,bi.getHeight(null) - fmHeight - fmHeight);
!                screen.updateImage(0,fmHeight * (crossRow + 1)- botOffset,
                                bi.getWidth(null),1);
!                screen.updateImage(crossRect.x,0,1,bi.getHeight(null) - fmHeight - fmHeight);
                 break;
           }
  
           g2.dispose();
!          g2 = getWritingArea(screen.font);
!          g2.setPaint(screen.colorBg);
  
           g2.fill(pArea);
!          g2.setColor(screen.colorWhite);
  
           g2.drawString((row + 1) + "/" + (col + 1)
                          ,(float)pArea.getX(),
                          (float)pArea.getY() + fmHeight);
!          screen.updateImage(pArea.getBounds());
           g2.dispose();
  

Index: Screen5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Screen5250.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** Screen5250.java	6 Jul 2004 05:39:28 -0000	1.66
--- Screen5250.java	6 Jul 2004 06:26:14 -0000	1.67
***************
*** 93,97 ****
  	public boolean cursorActive = false;
  	public boolean cursorShown = false;
! 	private boolean insertMode = false;
  	private boolean keyProcessed = false;
  	private Rectangle dirty = new Rectangle();
--- 93,97 ----
  	public boolean cursorActive = false;
  	public boolean cursorShown = false;
! 	protected boolean insertMode = false;
  	private boolean keyProcessed = false;
  	private Rectangle dirty = new Rectangle();
***************
*** 100,104 ****
  	private Point startPoint;
  	private Point endPoint;
! 	private int crossHair = 0;
  	private boolean messageLight = false;
  	public int homePos = 0;
--- 100,104 ----
  	private Point startPoint;
  	private Point endPoint;
! 	protected int crossHair = 0;
  	private boolean messageLight = false;
  	public int homePos = 0;
***************
*** 108,112 ****
  	public boolean pendingInsert = false;
  	private Gui5250 gui;
! 	private int cursorSize = 0;
  	private boolean hotSpots = false;
  	private boolean showHex = false;
--- 108,112 ----
  	public boolean pendingInsert = false;
  	private Gui5250 gui;
! 	protected int cursorSize = 0;
  	private boolean hotSpots = false;
  	private boolean showHex = false;
***************
*** 140,147 ****
  	private Rectangle restriction;
  	private boolean resetRequired;
! 	private int cursorBottOffset;
  	private boolean defaultPrinter;
  	private SessionConfig config;
! 	private boolean rulerFixed;
  	private boolean antialiased = true;
  	private boolean feError;
--- 140,147 ----
  	private Rectangle restriction;
  	private boolean resetRequired;
! 	protected int cursorBottOffset;
  	private boolean defaultPrinter;
  	private SessionConfig config;
! 	protected boolean rulerFixed;
  	private boolean antialiased = true;
  	private boolean feError;
***************
*** 1470,1476 ****
  			int col = getCol(lastPos);
  
! 			bi.drawCursor(this, row, col, fmWidth, fmHeight, insertMode,
! 					crossHair, rulerFixed, cursorSize, colorCursor, colorBg,
! 					colorWhite, font, cursorBottOffset);
  
  		}
--- 1470,1477 ----
  			int col = getCol(lastPos);
  
! //			bi.drawCursor(this, row, col, fmWidth, fmHeight, insertMode,
! //					crossHair, rulerFixed, cursorSize, colorCursor, colorBg,
! //					colorWhite, font, cursorBottOffset);
! 			bi.drawCursor();
  
  		}



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