mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Text_Display.cxx
void Fl_Text_Display::draw_cursor( int X, int Y ) {
  typedef struct {
    int x1, y1, x2, y2;
  }
  Segment;
  
  Segment segs[ 5 ];
  int left, right, cursorWidth, midY;
  //    int fontWidth = mFontStruct->min_bounds.width, nSegs = 0;
  int fontWidth = TMPFONTWIDTH; // CET - FIXME
  int nSegs = 0;
  int fontHeight = mMaxsize;
  int bot = Y + fontHeight - 1;
  
  if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
    return;
  
  /* For cursors other than the block, make them around 2/3 of a character
   width, rounded to an even number of pixels so that X will draw an
   odd number centered on the stem at x. */
  cursorWidth = 4;   //(fontWidth/3) * 2;
  left = X - cursorWidth / 2;
  right = left + cursorWidth;
  
  /* Create segments and draw cursor */
  if ( mCursorStyle == CARET_CURSOR ) {
    midY = bot - fontHeight / 5;
    segs[ 0 ].x1 = left; segs[ 0 ].y1 = bot; segs[ 0 ].x2 = X; segs[ 0 ].y2 = midY;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = midY - 1;
    segs[ 3 ].x1 = X; segs[ 3 ].y1 = midY - 1; segs[ 3 ].x2 = right; segs[ 3 ].y2 = bot;
    nSegs = 4;
  } else if ( mCursorStyle == NORMAL_CURSOR ) {
    segs[ 0 ].x1 = left; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = right; segs[ 2 ].y2 = bot;
    nSegs = 3;
  } else if ( mCursorStyle == HEAVY_CURSOR ) {
    segs[ 0 ].x1 = X - 1; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X - 1; segs[ 0 ].y2 = bot;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = X + 1; segs[ 2 ].y1 = Y; segs[ 2 ].x2 = X + 1; segs[ 2 ].y2 = bot;
    segs[ 3 ].x1 = left; segs[ 3 ].y1 = Y; segs[ 3 ].x2 = right; segs[ 3 ].y2 = Y;
    segs[ 4 ].x1 = left; segs[ 4 ].y1 = bot; segs[ 4 ].x2 = right; segs[ 4 ].y2 = bot;
    nSegs = 5;
  } else if ( mCursorStyle == DIM_CURSOR ) {
    midY = Y + fontHeight / 2;
    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = X; segs[ 1 ].y2 = midY;
    segs[ 2 ].x1 = X; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
    nSegs = 3;
  } else if ( mCursorStyle == BLOCK_CURSOR ) {
    right = X + fontWidth;
    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = right; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = right; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
    segs[ 3 ].x1 = X; segs[ 3 ].y1 = bot; segs[ 3 ].x2 = X; segs[ 3 ].y2 = Y;
    nSegs = 4;
  }
  fl_color( mCursor_color );
  
  for ( int k = 0; k < nSegs; k++ ) {
    fl_line( segs[ k ].x1, segs[ k ].y1, segs[ k ].x2, segs[ k ].y2 );
  }
}
/**
 \brief Draw a cursor with top center at X, y.
 
 \param X, Y cursor position in pixels
 */
\brief Draw a cursor with top center at X, y.
\param X, Y cursor position in pixels
\ brief Draw a cursor with top center at X y . \ param X Y cursor position in pixels
void Fl_Text_Display::draw_cursor( int X, int Y ) {
  typedef struct {
    int x1, y1, x2, y2;
  }
  Segment;
  Segment segs[ 5 ];
  int left, right, cursorWidth, midY;
  int fontWidth = TMPFONTWIDTH; 
  int nSegs = 0;
  int fontHeight = mMaxsize;
  int bot = Y + fontHeight - 1;
  if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
    return;
  cursorWidth = 4;   
  left = X - cursorWidth / 2;
  right = left + cursorWidth;
  if ( mCursorStyle == CARET_CURSOR ) {
    midY = bot - fontHeight / 5;
    segs[ 0 ].x1 = left; segs[ 0 ].y1 = bot; segs[ 0 ].x2 = X; segs[ 0 ].y2 = midY;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = midY - 1;
    segs[ 3 ].x1 = X; segs[ 3 ].y1 = midY - 1; segs[ 3 ].x2 = right; segs[ 3 ].y2 = bot;
    nSegs = 4;
  } else if ( mCursorStyle == NORMAL_CURSOR ) {
    segs[ 0 ].x1 = left; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = right; segs[ 2 ].y2 = bot;
    nSegs = 3;
  } else if ( mCursorStyle == HEAVY_CURSOR ) {
    segs[ 0 ].x1 = X - 1; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X - 1; segs[ 0 ].y2 = bot;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = X + 1; segs[ 2 ].y1 = Y; segs[ 2 ].x2 = X + 1; segs[ 2 ].y2 = bot;
    segs[ 3 ].x1 = left; segs[ 3 ].y1 = Y; segs[ 3 ].x2 = right; segs[ 3 ].y2 = Y;
    segs[ 4 ].x1 = left; segs[ 4 ].y1 = bot; segs[ 4 ].x2 = right; segs[ 4 ].y2 = bot;
    nSegs = 5;
  } else if ( mCursorStyle == DIM_CURSOR ) {
    midY = Y + fontHeight / 2;
    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = X; segs[ 1 ].y2 = midY;
    segs[ 2 ].x1 = X; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
    nSegs = 3;
  } else if ( mCursorStyle == BLOCK_CURSOR ) {
    right = X + fontWidth;
    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
    segs[ 1 ].x1 = right; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
    segs[ 2 ].x1 = right; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
    segs[ 3 ].x1 = X; segs[ 3 ].y1 = bot; segs[ 3 ].x2 = X; segs[ 3 ].y2 = Y;
    nSegs = 4;
  }
  fl_color( mCursor_color );
  for ( int k = 0; k < nSegs; k++ ) {
    fl_line( segs[ k ].x1, segs[ k ].y1, segs[ k ].x2, segs[ k ].y2 );
  }
}
void Fl_Text_Display :: draw_cursor ( int X , int Y ) { typedef struct { int x1 , y1 , x2 , y2 ; } Segment ; Segment segs [ 5 ] ; int left , right , cursorWidth , midY ; int fontWidth = TMPFONTWIDTH ; int nSegs = 0 ; int fontHeight = mMaxsize ; int bot = Y + fontHeight - 1 ; if ( X < text_area . x - 1 || X > text_area . x + text_area . w ) return ; cursorWidth = 4 ; left = X - cursorWidth / 2 ; right = left + cursorWidth ; if ( mCursorStyle == CARET_CURSOR ) { midY = bot - fontHeight / 5 ; segs [ 0 ] . x1 = left ; segs [ 0 ] . y1 = bot ; segs [ 0 ] . x2 = X ; segs [ 0 ] . y2 = midY ; segs [ 1 ] . x1 = X ; segs [ 1 ] . y1 = midY ; segs [ 1 ] . x2 = right ; segs [ 1 ] . y2 = bot ; segs [ 2 ] . x1 = left ; segs [ 2 ] . y1 = bot ; segs [ 2 ] . x2 = X ; segs [ 2 ] . y2 = midY - 1 ; segs [ 3 ] . x1 = X ; segs [ 3 ] . y1 = midY - 1 ; segs [ 3 ] . x2 = right ; segs [ 3 ] . y2 = bot ; nSegs = 4 ; } else if ( mCursorStyle == NORMAL_CURSOR ) { segs [ 0 ] . x1 = left ; segs [ 0 ] . y1 = Y ; segs [ 0 ] . x2 = right ; segs [ 0 ] . y2 = Y ; segs [ 1 ] . x1 = X ; segs [ 1 ] . y1 = Y ; segs [ 1 ] . x2 = X ; segs [ 1 ] . y2 = bot ; segs [ 2 ] . x1 = left ; segs [ 2 ] . y1 = bot ; segs [ 2 ] . x2 = right ; segs [ 2 ] . y2 = bot ; nSegs = 3 ; } else if ( mCursorStyle == HEAVY_CURSOR ) { segs [ 0 ] . x1 = X - 1 ; segs [ 0 ] . y1 = Y ; segs [ 0 ] . x2 = X - 1 ; segs [ 0 ] . y2 = bot ; segs [ 1 ] . x1 = X ; segs [ 1 ] . y1 = Y ; segs [ 1 ] . x2 = X ; segs [ 1 ] . y2 = bot ; segs [ 2 ] . x1 = X + 1 ; segs [ 2 ] . y1 = Y ; segs [ 2 ] . x2 = X + 1 ; segs [ 2 ] . y2 = bot ; segs [ 3 ] . x1 = left ; segs [ 3 ] . y1 = Y ; segs [ 3 ] . x2 = right ; segs [ 3 ] . y2 = Y ; segs [ 4 ] . x1 = left ; segs [ 4 ] . y1 = bot ; segs [ 4 ] . x2 = right ; segs [ 4 ] . y2 = bot ; nSegs = 5 ; } else if ( mCursorStyle == DIM_CURSOR ) { midY = Y + fontHeight / 2 ; segs [ 0 ] . x1 = X ; segs [ 0 ] . y1 = Y ; segs [ 0 ] . x2 = X ; segs [ 0 ] . y2 = Y ; segs [ 1 ] . x1 = X ; segs [ 1 ] . y1 = midY ; segs [ 1 ] . x2 = X ; segs [ 1 ] . y2 = midY ; segs [ 2 ] . x1 = X ; segs [ 2 ] . y1 = bot ; segs [ 2 ] . x2 = X ; segs [ 2 ] . y2 = bot ; nSegs = 3 ; } else if ( mCursorStyle == BLOCK_CURSOR ) { right = X + fontWidth ; segs [ 0 ] . x1 = X ; segs [ 0 ] . y1 = Y ; segs [ 0 ] . x2 = right ; segs [ 0 ] . y2 = Y ; segs [ 1 ] . x1 = right ; segs [ 1 ] . y1 = Y ; segs [ 1 ] . x2 = right ; segs [ 1 ] . y2 = bot ; segs [ 2 ] . x1 = right ; segs [ 2 ] . y1 = bot ; segs [ 2 ] . x2 = X ; segs [ 2 ] . y2 = bot ; segs [ 3 ] . x1 = X ; segs [ 3 ] . y1 = bot ; segs [ 3 ] . x2 = X ; segs [ 3 ] . y2 = Y ; nSegs = 4 ; } fl_color ( mCursor_color ) ; for ( int k = 0 ; k < nSegs ; k ++ ) { fl_line ( segs [ k ] . x1 , segs [ k ] . y1 , segs [ k ] . x2 , segs [ k ] . y2 ) ; } }
\brief Draw a cursor with top center at X, y.
\ brief Draw a cursor with top center at X y .
//    int fontWidth = mFontStruct->min_bounds.width, nSegs = 0; // CET - FIXME /* For cursors other than the block, make them around 2/3 of a character
   width, rounded to an even number of pixels so that X will draw an
   odd number centered on the stem at x. */ //(fontWidth/3) * 2; /* Create segments and draw cursor */