#ifndef _XJTEXT
#define _XJTEXT
#include "xtext.h"

const int               MaxXCharTmp=1024;
class xJTextWindow      :public xTextWindow
{
  int                   TopY;
  int                   BottomY;
  int                   RightX;
  int                   LeftX;
  int                   LineWidth;
  int                   MainLineWidth;
  int                   RubyOffset;
  int                   RubyLeftOffset;
  int                   CurrentX;
  int                   CurrentY;
  int                   CurrentColor;
  int                   CurrentButtonID;
  int                   XCharTmpCnt;
  xchar*                XCharTmp;
  int                   TmpY;
  int                   TmpYRuby;
  int                   TmpYRubyLeft;
public:
                        xJTextWindow   (int Width,int Height,
					char* FG,char*  SG,char* BG,
					char*FNA,char*FNAT,char*FNK,char*FNKT);
          int           newlineOK      (uchar Byte1 ,uchar Byte2);
          int           putText        (char*  Text);
          int           putAText       (char* AText);
          int           putJText       (char* JText);
          int           putHText       (char* AText);
	  int           putKunten      (char* JText);
	  int           putKuntenB     (char* JText);
  	  int           putTmpAText    (char* AText);
	  int           putTmpJText    (char* JText);
	  int           putTmpKunten   (char* JText);
	  int           putTmpKuntenB  (char* JText);
	  int           putTmpARuby    (char* AText);
	  int           putTmpJRuby    (char* AText);
	  int           putTmpARubyLeft(char* AText);
	  int           putTmpJRubyLeft(char* AText);
	  int           setTmpToText   (void);
  inline  void          setColor       (char* ColorName)
  { CurrentColor=colorID(ColorName);}
  inline  void          setImage       (char* ImageFileName)
  { setBGImage(ImageFileName);drawText();}
  inline  void          setTile        (char* ImageFileName)
  { setBGTile (ImageFileName);drawText();}
  inline  void          newPage        (void)
  { newTextPage();CurrentY =TopY;CurrentX =RightX;}
  inline  int           putTab         (void)
  { CurrentY = ((CurrentY-TopY)/(CharHeightKANJI*4)+1)*CharHeightKANJI*4+TopY;}
  inline  int           newline        (void)
  { CurrentX-=LineWidth;CurrentY=TopY;}
  inline  void          newPar         (void)
  { 
    CurrentX-=LineWidth;
    if(CurrentX<LeftX) newPage();
    CurrentY=TopY+CharHeightKANJI;
  }
  inline  void          newParPage     (void)
  { newTextPage();CurrentY =TopY+CharHeightKANJI;CurrentX =RightX;}
};

#endif



