mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Text_Display.cxx
void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
  switch (wrap) {
    case WRAP_NONE: 
      mWrapMarginPix = 0;
      mContinuousWrap = 0;
      break;
    case WRAP_AT_COLUMN: 
    default:
      mWrapMarginPix = int(col_to_x(wrapMargin));
      mContinuousWrap = 1;
      break;
    case WRAP_AT_PIXEL: 
      mWrapMarginPix = wrapMargin;
      mContinuousWrap = 1;
      break;
    case WRAP_AT_BOUNDS: 
      mWrapMarginPix = 0;
      mContinuousWrap = 1;
      break;
  }
  
  if (buffer()) {
    /* wrapping can change the total number of lines, re-count */
    mNBufferLines = count_lines(0, buffer()->length(), true);
    
    /* changing wrap margins or changing from wrapped mode to non-wrapped
     can leave the character at the top no longer at a line start, and/or
     change the line number */
    mFirstChar = line_start(mFirstChar);
    mTopLineNum = count_lines(0, mFirstChar, true) + 1;
    
    reset_absolute_top_line_number();
    
    /* update the line starts array */
    calc_line_starts(0, mNVisibleLines);
    calc_last_char();
  } else {
    // No buffer, so just clear the state info for later...
    mNBufferLines  = 0;
    mFirstChar     = 0;
    mTopLineNum    = 1;
    mAbsTopLineNum = 0;
  }
  
  resize(x(), y(), w(), h());
}
/**
 \brief Set the new text wrap mode.
 
 If \p mode is not zero, this call enables automatic word wrapping at column 
 \p pos. Word-wrapping does not change the text buffer itself, only the way that 
 the text is displayed. Different Text Displays can have different wrap modes,
 even if they share the same Text Buffer.
 
 \param wrap new wrap mode is WRAP_NONE (don't wrap text at all), WRAP_AT_COLUMN
      (wrap text at the given text column), WRAP_AT_PIXEL (wrap text at a pixel 
      position), or WRAP_AT_BOUNDS (wrap text so that it fits into the 
      widget width)
 \param wrapMargin in WRAP_AT_COLUMN mode, text will wrap at the n'th character.
      For variable width fonts, an average character width is calculated. The
      column width is calculated using the current textfont or the first style
      when this function is called. If the font size changes, this function
      must be called again. In WRAP_AT_PIXEL mode, this is the pixel position.
 \todo we need new wrap modes to wrap at the window edge and based on pixel width
   or average character width.
 */
\brief Set the new text wrap mode.
If \p mode is not zero, this call enables automatic word wrapping at column
\p pos. Word-wrapping does not change the text buffer itself, only the way that
the text is displayed. Different Text Displays can have different wrap modes,
even if they share the same Text Buffer.

\param wrap new wrap mode is WRAP_NONE (don't wrap text at all), WRAP_AT_COLUMN
(wrap text at the given text column), WRAP_AT_PIXEL (wrap text at a pixel
position), or WRAP_AT_BOUNDS (wrap text so that it fits into the
widget width)
\param wrapMargin in WRAP_AT_COLUMN mode, text will wrap at the n'th character.
For variable width fonts, an average character width is calculated. The
column width is calculated using the current textfont or the first style
when this function is called. If the font size changes, this function
must be called again. In WRAP_AT_PIXEL mode, this is the pixel position.
\todo we need new wrap modes to wrap at the window edge and based on pixel width
or average character width.
\ brief Set the new text wrap mode . If \ p mode is not zero this call enables automatic word wrapping at column \ p pos . Word - wrapping does not change the text buffer itself only the way that the text is displayed . Different Text Displays can have different wrap modes even if they share the same Text Buffer . \ param wrap new wrap mode is WRAP_NONE ( don ' t wrap text at all ) WRAP_AT_COLUMN ( wrap text at the given text column ) WRAP_AT_PIXEL ( wrap text at a pixel position ) or WRAP_AT_BOUNDS ( wrap text so that it fits into the widget width ) \ param wrapMargin in WRAP_AT_COLUMN mode text will wrap at the n ' th character . For variable width fonts an average character width is calculated . The column width is calculated using the current textfont or the first style when this function is called . If the font size changes this function must be called again . In WRAP_AT_PIXEL mode this is the pixel position . \ todo we need new wrap modes to wrap at the window edge and based on pixel width or average character width .
void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
  switch (wrap) {
    case WRAP_NONE: 
      mWrapMarginPix = 0;
      mContinuousWrap = 0;
      break;
    case WRAP_AT_COLUMN: 
    default:
      mWrapMarginPix = int(col_to_x(wrapMargin));
      mContinuousWrap = 1;
      break;
    case WRAP_AT_PIXEL: 
      mWrapMarginPix = wrapMargin;
      mContinuousWrap = 1;
      break;
    case WRAP_AT_BOUNDS: 
      mWrapMarginPix = 0;
      mContinuousWrap = 1;
      break;
  }
  if (buffer()) {
    mNBufferLines = count_lines(0, buffer()->length(), true);
    mFirstChar = line_start(mFirstChar);
    mTopLineNum = count_lines(0, mFirstChar, true) + 1;
    reset_absolute_top_line_number();
    calc_line_starts(0, mNVisibleLines);
    calc_last_char();
  } else {
    mNBufferLines  = 0;
    mFirstChar     = 0;
    mTopLineNum    = 1;
    mAbsTopLineNum = 0;
  }
  resize(x(), y(), w(), h());
}
void Fl_Text_Display :: wrap_mode ( int wrap , int wrapMargin ) { switch ( wrap ) { case WRAP_NONE : mWrapMarginPix = 0 ; mContinuousWrap = 0 ; break ; case WRAP_AT_COLUMN : default : mWrapMarginPix = int ( col_to_x ( wrapMargin ) ) ; mContinuousWrap = 1 ; break ; case WRAP_AT_PIXEL : mWrapMarginPix = wrapMargin ; mContinuousWrap = 1 ; break ; case WRAP_AT_BOUNDS : mWrapMarginPix = 0 ; mContinuousWrap = 1 ; break ; } if ( buffer ( ) ) { mNBufferLines = count_lines ( 0 , buffer ( ) -> length ( ) , true ) ; mFirstChar = line_start ( mFirstChar ) ; mTopLineNum = count_lines ( 0 , mFirstChar , true ) + 1 ; reset_absolute_top_line_number ( ) ; calc_line_starts ( 0 , mNVisibleLines ) ; calc_last_char ( ) ; } else { mNBufferLines = 0 ; mFirstChar = 0 ; mTopLineNum = 1 ; mAbsTopLineNum = 0 ; } resize ( x ( ) , y ( ) , w ( ) , h ( ) ) ; }
\brief Set the new text wrap mode.
\ brief Set the new text wrap mode .
/* wrapping can change the total number of lines, re-count */ /* changing wrap margins or changing from wrapped mode to non-wrapped
     can leave the character at the top no longer at a line start, and/or
     change the line number */ /* update the line starts array */ // No buffer, so just clear the state info for later...