Non-changing changes... Attempting to keep the porting branch somehwat in-sync with doc changes in main 1.3.x

None of these changes alter the actual code.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11076 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Ian MacArthur 2016-01-28 17:16:32 +00:00
parent ed9ac2aba3
commit 5aefd057d1
3 changed files with 319 additions and 280 deletions

22
FL/Fl.H
View File

@ -434,15 +434,19 @@ public:
stdout with a fair degree of accuracy: stdout with a fair degree of accuracy:
\code \code
void callback(void*) { #include <stdio.h>
puts("TICK"); #include <FL/Fl.H>
Fl::repeat_timeout(1.0, callback); #include <FL/Fl_Window.H>
} void callback(void*) {
printf("TICK\n");
int main() { Fl::repeat_timeout(1.0, callback); // retrigger timeout
Fl::add_timeout(1.0, callback); }
return Fl::run(); int main() {
} Fl_Window win(100,100);
win.show();
Fl::add_timeout(1.0, callback); // set up first timeout
return Fl::run();
}
\endcode \endcode
*/ */
static void add_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent static void add_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent

View File

@ -3,7 +3,7 @@
// //
// Header file for Fl_Text_Buffer class. // Header file for Fl_Text_Buffer class.
// //
// Copyright 2001-2010 by Bill Spitzak and others. // Copyright 2001-2016 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under // Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel. // the LGPL for the FLTK library granted by Mark Edel.
// //
@ -44,7 +44,7 @@
an average character width (which is a bearable approximation). an average character width (which is a bearable approximation).
* in Unicode, there are no fixed width fonts! Even if the ASCII characters may * in Unicode, there are no fixed width fonts! Even if the ASCII characters may
happen to be all the same width in pixels, chinese charcaters surely are not. happen to be all the same width in pixels, Chinese characters surely are not.
There are plenty of exceptions, like ligatures, that make special handling of There are plenty of exceptions, like ligatures, that make special handling of
"fixed" character widths a nightmare. I decided to remove all references to "fixed" character widths a nightmare. I decided to remove all references to
fixed fonts and see "columns" as a multiple of the average width of a fixed fonts and see "columns" as a multiple of the average width of a
@ -54,7 +54,7 @@
/* Maximum length in characters of a tab or control character expansion /* Maximum length in characters of a tab or control character expansion
of a single buffer character */ of a single buffer character */
#define FL_TEXT_MAX_EXP_CHAR_LEN 20 #define FL_TEXT_MAX_EXP_CHAR_LEN 20
#include "Fl_Export.H" #include "Fl_Export.H"
@ -63,7 +63,7 @@
/** /**
\class Fl_Text_Selection \class Fl_Text_Selection
\brief This is an internal class for Fl_Text_Buffer to manage text selections. \brief This is an internal class for Fl_Text_Buffer to manage text selections.
This class works correctly with utf-8 strings assuming that the parameters This class works correctly with UTF-8 strings assuming that the parameters
for all calls are on character boundaries. for all calls are on character boundaries.
*/ */
class FL_EXPORT Fl_Text_Selection { class FL_EXPORT Fl_Text_Selection {
@ -79,9 +79,10 @@ public:
void set(int start, int end); void set(int start, int end);
/** /**
\brief Updates a selection afer text was modified. \brief Updates a selection after text was modified.
Updates an individual selection for changes in the corresponding text Updates an individual selection for changes in the corresponding text
\param pos byte offset into text buffer at which the change occured \param pos byte offset into text buffer at which the change occurred
\param nDeleted number of bytes deleted from the buffer \param nDeleted number of bytes deleted from the buffer
\param nInserted number of bytes inserted into the buffer \param nInserted number of bytes inserted into the buffer
*/ */
@ -94,7 +95,7 @@ public:
int start() const { return mStart; } int start() const { return mStart; }
/** /**
\brief Return the byte ofsset to the character after the last selected character. \brief Return the byte offset to the character after the last selected character.
\return byte offset \return byte offset
*/ */
int end() const { return mEnd; } int end() const { return mEnd; }
@ -120,8 +121,8 @@ public:
/** /**
\brief Return the positions of this selection. \brief Return the positions of this selection.
\param start retrun byte offset to first selected character \param start return byte offset to first selected character
\param end retrun byte offset pointing after last selected character \param end return byte offset pointing after last selected character
\return true if selected \return true if selected
*/ */
int position(int* start, int* end) const; int position(int* start, int* end) const;
@ -143,9 +144,9 @@ typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
/** /**
\brief This class manages unicode displayed in one or more Fl_Text_Display widgets. \brief This class manages Unicode text displayed in one or more Fl_Text_Display widgets.
All text in Fl_Text_Buffermust be encoded in UTF-8. All indices used in the All text in Fl_Text_Buffer must be encoded in UTF-8. All indices used in the
function calls must be aligned to the start of a UTF-8 sequence. All indices function calls must be aligned to the start of a UTF-8 sequence. All indices
and pointers returned will be aligned. All functions that return a single and pointers returned will be aligned. All functions that return a single
character will return that in an unsiged int in UCS-4 encoding. character will return that in an unsiged int in UCS-4 encoding.
@ -163,7 +164,7 @@ public:
if you know exactly how much the buffer will need to hold if you know exactly how much the buffer will need to hold
\param preferredGapSize Initial size for the buffer gap (empty space \param preferredGapSize Initial size for the buffer gap (empty space
in the buffer where text might be inserted in the buffer where text might be inserted
if the user is typing sequential chars) if the user is typing sequential characters)
*/ */
Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024); Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024);
@ -182,13 +183,13 @@ public:
\brief Get a copy of the entire contents of the text buffer. \brief Get a copy of the entire contents of the text buffer.
Memory is allocated to contain the returned string, which the caller Memory is allocated to contain the returned string, which the caller
must free. must free.
\return newly allocated text buffer - must be free'd, text is utf8 \return newly allocated text buffer - must be free'd, text is UTF-8
*/ */
char* text() const; char* text() const;
/** /**
Replaces the entire contents of the text buffer. Replaces the entire contents of the text buffer.
\param text Text must be valid utf8. if null an empty string is substituted. \param text Text must be valid UTF-8. If null, an empty string is substituted.
*/ */
void text(const char* text); void text(const char* text);
@ -200,21 +201,21 @@ public:
When you are done with the text, free it using the free() function. When you are done with the text, free it using the free() function.
\param start byte offset to first character \param start byte offset to first character
\param end byte offset after last character in range \param end byte offset after last character in range
\return newly allocated text buffer - must be free'd, text is utf8 \return newly allocated text buffer - must be free'd, text is UTF-8
*/ */
char* text_range(int start, int end) const; char* text_range(int start, int end) const;
/** /**
Returns the character at the specified position pos in the buffer. Returns the character at the specified position \p pos in the buffer.
Positions start at 0 Positions start at 0.
\param pos byte offset into buffer, pos must be at a character boundary \param pos byte offset into buffer, \p pos must be at a UTF-8 character boundary
\return Unicode UCS-4 encoded character \return Unicode UCS-4 encoded character
*/ */
unsigned int char_at(int pos) const; unsigned int char_at(int pos) const;
/** /**
Returns the raw byte at the specified position pos in the buffer. Returns the raw byte at the specified position pos in the buffer.
Positions start at 0 Positions start at 0.
\param pos byte offset into buffer \param pos byte offset into buffer
\return unencoded raw byte \return unencoded raw byte
*/ */
@ -238,35 +239,36 @@ public:
/** /**
Inserts null-terminated string \p text at position \p pos. Inserts null-terminated string \p text at position \p pos.
\param pos insertion position as byte offset (must be utf-8 character aligned) \param pos insertion position as byte offset (must be UTF-8 character aligned)
\param text utf-8 encoded and nul terminated text \param text UTF-8 encoded and nul terminated text
*/ */
void insert(int pos, const char* text); void insert(int pos, const char* text);
/** /**
Appends the text string to the end of the buffer. Appends the text string to the end of the buffer.
\param t utf-8 encoded and nul terminated text \param t UTF-8 encoded and nul terminated text
*/ */
void append(const char* t) { insert(length(), t); } void append(const char* t) { insert(length(), t); }
/** /**
Deletes a range of characters in the buffer. Deletes a range of characters in the buffer.
\param start byte offset to first character to be removed \param start byte offset to first character to be removed
\param end byte offset to charcatre after last character to be removed \param end byte offset to charcater after last character to be removed
*/ */
void remove(int start, int end); void remove(int start, int end);
/** /**
Deletes the characters between \p start and \p end, and inserts the null-terminated string \p text in their place in the buffer. Deletes the characters between \p start and \p end, and inserts the
null-terminated string \p text in their place in the buffer.
\param start byte offset to first character to be removed and new insert position \param start byte offset to first character to be removed and new insert position
\param end byte offset to charcatre after last character to be removed \param end byte offset to character after last character to be removed
\param text utf-8 encoded and nul terminated text \param text UTF-8 encoded and nul terminated text
*/ */
void replace(int start, int end, const char *text); void replace(int start, int end, const char *text);
/** /**
Copies text from one buffer to this one. Copies text from another Fl_Text_Buffer to this one.
\param fromBuf source text buffer may be the same as this \param fromBuf source text buffer, may be the same as this
\param fromStart byte offset into buffer \param fromStart byte offset into buffer
\param fromEnd byte offset into buffer \param fromEnd byte offset into buffer
\param toPos destination byte offset into buffer \param toPos destination byte offset into buffer
@ -285,13 +287,17 @@ public:
void canUndo(char flag=1); void canUndo(char flag=1);
/** /**
Inserts a file at the specified position. Returns 0 on success, Inserts a file at the specified position.
non-zero on error (strerror() contains reason). 1 indicates open Returns
for read failed (no data loaded). 2 indicates error occurred - 0 on success
while reading data (data was partially loaded). - non-zero on error (strerror() contains reason)
File can be UTF-8 or CP1252-encoded. - 1 indicates open for read failed (no data loaded)
If the input file is not UTF-8-encoded, the Fl_Text_Buffer widget will contain - 2 indicates error occurred while reading data (data was partially loaded)
UTF-8-transcoded data. By default, the message Fl_Text_Buffer::file_encoding_warning_message
File can be UTF-8 or CP1252 encoded.
If the input file is not UTF-8 encoded, the Fl_Text_Buffer widget will
contain data transcoded to UTF-8. By default, the message
Fl_Text_Buffer::file_encoding_warning_message
will warn the user about this. will warn the user about this.
\see input_file_was_transcoded and transcoding_warning_action. \see input_file_was_transcoded and transcoding_warning_action.
*/ */
@ -310,10 +316,12 @@ public:
{ select(0, length()); remove_selection(); return appendfile(file, buflen); } { select(0, length()); remove_selection(); return appendfile(file, buflen); }
/** /**
Writes the specified portions of the file to a file. Returns 0 on success, non-zero Writes the specified portions of the text buffer to a file.
on error (strerror() contains reason). 1 indicates open for write failed Returns
(no data saved). 2 indicates error occurred while writing data - 0 on success
(data was partially saved). - non-zero on error (strerror() contains reason)
- 1 indicates open for write failed (no data saved)
- 2 indicates error occurred while writing data (data was partially saved)
*/ */
int outputfile(const char *file, int start, int end, int buflen = 128*1024); int outputfile(const char *file, int start, int end, int buflen = 128*1024);
@ -325,6 +333,9 @@ public:
/** /**
Gets the tab width. Gets the tab width.
The tab width is measured in characters. The pixel position is
calculated using an average character width.
*/ */
int tab_distance() const { return mTabDist; } int tab_distance() const { return mTabDist; }
@ -340,23 +351,24 @@ public:
void select(int start, int end); void select(int start, int end);
/** /**
Returns a non 0 value if text has been selected, 0 otherwise Returns a non-zero value if text has been selected, 0 otherwise.
*/ */
int selected() const { return mPrimary.selected(); } int selected() const { return mPrimary.selected(); }
/** /**
Cancels any previous selection on the primary text selection object Cancels any previous selection on the primary text selection object.
*/ */
void unselect(); void unselect();
/** /**
Gets the selection position Gets the selection position.
*/ */
int selection_position(int* start, int* end); int selection_position(int* start, int* end);
/** /**
Returns the currently selected text. When you are done with Returns the currently selected text.
the text, free it using the free() function.
When you are done with the text, free it using the free() function.
*/ */
char* selection_text(); char* selection_text();
@ -376,8 +388,8 @@ public:
void secondary_select(int start, int end); void secondary_select(int start, int end);
/** /**
Returns a non 0 value if text has been selected in the secondary Returns a non-zero value if text has been selected in the secondary
text selection, 0 otherwise text selection, 0 otherwise.
*/ */
int secondary_selected() { return mSecondary.selected(); } int secondary_selected() { return mSecondary.selected(); }
@ -392,13 +404,15 @@ public:
int secondary_selection_position(int* start, int* end); int secondary_selection_position(int* start, int* end);
/** /**
Returns the text in the secondary selection. When you are Returns the text in the secondary selection.
done with the text, free it using the free() function.
When you are done with the text, free it using the free() function.
*/ */
char* secondary_selection_text(); char* secondary_selection_text();
/** /**
Removes the text from the buffer corresponding to the secondary text selection object. Removes the text from the buffer corresponding to the secondary text
selection object.
*/ */
void remove_secondary_selection(); void remove_secondary_selection();
@ -414,8 +428,9 @@ public:
void highlight(int start, int end); void highlight(int start, int end);
/** /**
Returns the highlighted text. When you are done with the Returns the highlighted text.
text, free it using the free() function.
When you are done with the text, free it using the free() function.
*/ */
int highlight() { return mHighlight.selected(); } int highlight() { return mHighlight.selected(); }
@ -430,14 +445,16 @@ public:
int highlight_position(int* start, int* end); int highlight_position(int* start, int* end);
/** /**
Returns the highlighted text. When you are done with the Returns the highlighted text.
text, free it using the free() function.
When you are done with the text, free it using the free() function.
*/ */
char* highlight_text(); char* highlight_text();
/** /**
Adds a callback function that is called whenever the text buffer is Adds a callback function that is called whenever the text buffer is modified.
modified. The callback function is declared as follows:
The callback function is declared as follows:
\code \code
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted, typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
@ -454,8 +471,7 @@ public:
/** /**
Calls all modify callbacks that have been registered using Calls all modify callbacks that have been registered using
the add_modify_callback() the add_modify_callback() method.
method.
*/ */
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); } void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
@ -478,10 +494,11 @@ public:
/** /**
Returns the text from the entire line containing the specified Returns the text from the entire line containing the specified
character position. When you are done with the text, free it character position.
using the free() function.
When you are done with the text, free it using the free() function.
\param pos byte index into buffer \param pos byte index into buffer
\return copy of utf8 text, must be free'd \return copy of UTF-8 text, must be free'd
*/ */
char* line_text(int pos) const; char* line_text(int pos) const;
@ -493,16 +510,16 @@ public:
int line_start(int pos) const; int line_start(int pos) const;
/** /**
Finds and returns the position of the end of the line containing position \p pos Finds and returns the position of the end of the line containing position
(which is either a pointer to the newline character ending the line, \p pos (which is either a pointer to the newline character ending the line
or a pointer to one character beyond the end of the buffer) or a pointer to one character beyond the end of the buffer).
\param pos byte index into buffer \param pos byte index into buffer
\return byte offset to line end \return byte offset to line end
*/ */
int line_end(int pos) const; int line_end(int pos) const;
/** /**
Returns the position corresponding to the start of the word Returns the position corresponding to the start of the word.
\param pos byte index into buffer \param pos byte index into buffer
\return byte offset to word start \return byte offset to word start
*/ */
@ -517,16 +534,18 @@ public:
/** /**
Count the number of displayed characters between buffer position Count the number of displayed characters between buffer position
\p lineStartPos and \p targetPos. (displayed characters are the characters \p lineStartPos and \p targetPos.
shown on the screen to represent characters in the buffer, where tabs and
control characters are expanded) Displayed characters are the characters shown on the screen to represent
characters in the buffer, where tabs and control characters are expanded.
*/ */
int count_displayed_characters(int lineStartPos, int targetPos) const; int count_displayed_characters(int lineStartPos, int targetPos) const;
/** /**
Count forward from buffer position \p startPos in displayed characters Count forward from buffer position \p startPos in displayed characters.
(displayed characters are the characters shown on the screen to represent
characters in the buffer, where tabs and control characters are expanded) Displayed characters are the characters shown on the screen to represent
characters in the buffer, where tabs and control characters are expanded.
\param lineStartPos byte offset into buffer \param lineStartPos byte offset into buffer
\param nChars number of bytes that are sent to the display \param nChars number of bytes that are sent to the display
\return byte offset in input after all output bytes are sent \return byte offset in input after all output bytes are sent
@ -541,25 +560,27 @@ public:
/** /**
Finds the first character of the line \p nLines forward from \p startPos Finds the first character of the line \p nLines forward from \p startPos
in the buffer and returns its position in the buffer and returns its position.
*/ */
int skip_lines(int startPos, int nLines); int skip_lines(int startPos, int nLines);
/** /**
Finds and returns the position of the first character of the line \p nLines backwards Finds and returns the position of the first character of the line \p nLines
from \p startPos (not counting the character pointed to by \p startpos if backwards from \p startPos (not counting the character pointed to by
that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line \p startpos if that is a newline) in the buffer.
\p nLines == 0 means find the beginning of the line.
*/ */
int rewind_lines(int startPos, int nLines); int rewind_lines(int startPos, int nLines);
/** /**
Finds the next occurrence of the specified character. Finds the next occurrence of the specified character.
Search forwards in buffer for character \p searchChar, starting Search forwards in buffer for character \p searchChar, starting
with the character \p startPos, and returning the result in \p foundPos with the character \p startPos, and returning the result in \p foundPos.
returns 1 if found, 0 if not. (The difference between this and Returns 1 if found, 0 if not.
BufSearchForward is that it's optimized for single characters. The The difference between this and search_forward() is that it's optimized
overall performance of the text widget is dependent on its ability to for single characters. The overall performance of the text widget is
count lines quickly, hence searching for a single character: newline) dependent on its ability to count lines quickly, hence searching for a
single character: newline.
\param startPos byte offset to start position \param startPos byte offset to start position
\param searchChar UCS-4 character that we want to find \param searchChar UCS-4 character that we want to find
\param foundPos byte offset where the character was found \param foundPos byte offset where the character was found
@ -569,11 +590,12 @@ public:
/** /**
Search backwards in buffer \p buf for character \p searchChar, starting Search backwards in buffer \p buf for character \p searchChar, starting
with the character BEFORE \p startPos, returning the result in \p foundPos with the character \e before \p startPos, returning the result in \p foundPos.
returns 1 if found, 0 if not. (The difference between this and
BufSearchBackward is that it's optimized for single characters. The Returns 1 if found, 0 if not. The difference between this and
search_backward() is that it's optimized for single characters. The
overall performance of the text widget is dependent on its ability to overall performance of the text widget is dependent on its ability to
count lines quickly, hence searching for a single character: newline) count lines quickly, hence searching for a single character: newline.
\param startPos byte offset to start position \param startPos byte offset to start position
\param searchChar UCS-4 character that we want to find \param searchChar UCS-4 character that we want to find
\param foundPos byte offset where the character was found \param foundPos byte offset where the character was found
@ -583,10 +605,11 @@ public:
/** /**
Search forwards in buffer for string \p searchString, starting with the Search forwards in buffer for string \p searchString, starting with the
character \p startPos, and returning the result in \p foundPos character \p startPos, and returning the result in \p foundPos.
returns 1 if found, 0 if not.
Returns 1 if found, 0 if not.
\param startPos byte offset to start position \param startPos byte offset to start position
\param searchString utf8 string that we want to find \param searchString UTF-8 string that we want to find
\param foundPos byte offset where the string was found \param foundPos byte offset where the string was found
\param matchCase if set, match character case \param matchCase if set, match character case
\return 1 if found, 0 if not \return 1 if found, 0 if not
@ -595,11 +618,12 @@ public:
int matchCase = 0) const; int matchCase = 0) const;
/** /**
Search backwards in buffer for string <i>searchCharssearchString</i>, starting with the Search backwards in buffer for string \p searchString, starting with
character BEFORE \p startPos, returning the result in \p foundPos the character \e before \p startPos, returning the result in \p foundPos.
returns 1 if found, 0 if not.
Returns 1 if found, 0 if not.
\param startPos byte offset to start position \param startPos byte offset to start position
\param searchString utf8 string that we want to find \param searchString UTF-8 string that we want to find
\param foundPos byte offset where the string was found \param foundPos byte offset where the string was found
\param matchCase if set, match character case \param matchCase if set, match character case
\return 1 if found, 0 if not \return 1 if found, 0 if not
@ -629,25 +653,25 @@ public:
/** /**
Returns the index of the previous character. Returns the index of the previous character.
\param ix index to the current char \param ix index to the current character
*/ */
int prev_char(int ix) const; int prev_char(int ix) const;
int prev_char_clipped(int ix) const; int prev_char_clipped(int ix) const;
/** /**
Returns the index of the next character. Returns the index of the next character.
\param ix index to the current char \param ix index to the current character
*/ */
int next_char(int ix) const; int next_char(int ix) const;
int next_char_clipped(int ix) const; int next_char_clipped(int ix) const;
/** /**
Align an index into the buffer to the current or previous utf8 boundary. Align an index into the buffer to the current or previous UTF-8 boundary.
*/ */
int utf8_align(int) const; int utf8_align(int) const;
/** /**
\brief true iff the loaded file has been transcoded to UTF-8 \brief true if the loaded file has been transcoded to UTF-8.
*/ */
int input_file_was_transcoded; int input_file_was_transcoded;
@ -683,19 +707,21 @@ protected:
void call_predelete_callbacks(int pos, int nDeleted) const; void call_predelete_callbacks(int pos, int nDeleted) const;
/** /**
Internal (non-redisplaying) version of BufInsert. Returns the length of Internal (non-redisplaying) version of insert().
text inserted (this is just strlen(\p text), however this calculation can be
expensive and the length will be required by any caller who will continue Returns the length of text inserted (this is just strlen(\p text), however
on to call redisplay). \p pos must be contiguous with the existing text in this calculation can be expensive and the length will be required by any
the buffer (i.e. not past the end). caller who will continue on to call redisplay). \p pos must be contiguous
with the existing text in the buffer (i.e. not past the end).
\return the number of bytes inserted \return the number of bytes inserted
*/ */
int insert_(int pos, const char* text); int insert_(int pos, const char* text);
/** /**
Internal (non-redisplaying) version of BufRemove. Removes the contents Internal (non-redisplaying) version of remove().
of the buffer between start and end (and moves the gap to the site of
the delete). Removes the contents of the buffer between \p start and \p end (and moves
the gap to the site of the delete).
*/ */
void remove_(int start, int end); void remove_(int start, int end);
@ -738,29 +764,29 @@ protected:
Fl_Text_Selection mSecondary; /**< highlighted areas */ Fl_Text_Selection mSecondary; /**< highlighted areas */
Fl_Text_Selection mHighlight; /**< highlighted areas */ Fl_Text_Selection mHighlight; /**< highlighted areas */
int mLength; /**< length of the text in the buffer (the length int mLength; /**< length of the text in the buffer (the length
of the buffer itself must be calculated: of the buffer itself must be calculated:
gapEnd - gapStart + length) */ gapEnd - gapStart + length) */
char* mBuf; /**< allocated memory where the text is stored */ char* mBuf; /**< allocated memory where the text is stored */
int mGapStart; /**< points to the first character of the gap */ int mGapStart; /**< points to the first character of the gap */
int mGapEnd; /**< points to the first char after the gap */ int mGapEnd; /**< points to the first character after the gap */
// The hardware tab distance used by all displays for this buffer, // The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations. // and used in computing offsets for rectangular selection operations.
int mTabDist; /**< equiv. number of characters in a tab */ int mTabDist; /**< equiv. number of characters in a tab */
int mNModifyProcs; /**< number of modify-redisplay procs attached */ int mNModifyProcs; /**< number of modify-redisplay procs attached */
Fl_Text_Modify_Cb *mModifyProcs;/**< procedures to call when buffer is Fl_Text_Modify_Cb *mModifyProcs;/**< procedures to call when buffer is
modified to redisplay contents */ modified to redisplay contents */
void** mCbArgs; /**< caller arguments for modifyProcs above */ void** mCbArgs; /**< caller arguments for modifyProcs above */
int mNPredeleteProcs; /**< number of pre-delete procs attached */ int mNPredeleteProcs; /**< number of pre-delete procs attached */
Fl_Text_Predelete_Cb *mPredeleteProcs; /**< procedure to call before text is deleted Fl_Text_Predelete_Cb *mPredeleteProcs; /**< procedure to call before text is deleted
from the buffer; at most one is supported. */ from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */ void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
int mCursorPosHint; /**< hint for reasonable cursor position after int mCursorPosHint; /**< hint for reasonable cursor position after
a buffer modification operation */ a buffer modification operation */
char mCanUndo; /**< if this buffer is used for attributes, it must char mCanUndo; /**< if this buffer is used for attributes, it must
not do any undo calls */ not do any undo calls */
int mPreferredGapSize; /**< the default allocation for the text gap is 1024 int mPreferredGapSize; /**< the default allocation for the text gap is 1024
bytes and should only be increased if frequent bytes and should only be increased if frequent
and large changes in buffer size are expected */ and large changes in buffer size are expected */
}; };
#endif #endif

View File

@ -3,7 +3,7 @@
// //
// Header file for Fl_Text_Display class. // Header file for Fl_Text_Display class.
// //
// Copyright 2001-2010 by Bill Spitzak and others. // Copyright 2001-2016 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under // Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel. // the LGPL for the FLTK library granted by Mark Edel.
// //
@ -133,14 +133,23 @@ public:
typedef void (*Unfinished_Style_Cb)(int, void *); typedef void (*Unfinished_Style_Cb)(int, void *);
/** /**
This structure associates the color, font, andsize of a string to draw This structure associates the color, font, and font size of a string to draw
with an attribute mask matching attr with an attribute mask matching attr.
There must be one entry for each style that can be used in an
Fl_Text_Display for displaying text. The style table is an array of
struct Style_Table_Entry.
The style table is associated with an Fl_Text_Display by using
Fl_Text_Display::highlight_data().
\see Fl_Text_Display::highlight_data()
*/ */
struct Style_Table_Entry { struct Style_Table_Entry {
Fl_Color color; Fl_Color color; ///< text color
Fl_Font font; Fl_Font font; ///< text font
Fl_Fontsize size; Fl_Fontsize size; ///< text font size
unsigned attr; unsigned attr; ///< currently unused (this may be change in the future)
}; };
Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0); Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0);