Author: fabien
Date: 2009-07-03 17:06:32 -0700 (Fri, 03 Jul 2009)
New Revision: 6820
Log:
UTF8: Fl_Text_Display and related:
    + Even more const constraints added to Fl_Text_Selection and Fl_Text_Buffer 
methods.


Modified:
   branches/branch-1.3/FL/Fl_Text_Buffer.H
   branches/branch-1.3/src/Fl_Text_Buffer.cxx

Modified: branches/branch-1.3/FL/Fl_Text_Buffer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-03 23:54:34 UTC (rev 
6819)
+++ branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-04 00:06:32 UTC (rev 
6820)
@@ -106,7 +106,7 @@
     void text(const char* text);
     char* text_range(int start, int end) const;
     char character(int pos) const;
-    char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
+    char* text_in_rectangle(int start, int end, int rectStart, int rectEnd) 
const;
     void insert(int pos, const char* text);
   /**    Appends the text string to the end of the buffer.  */
     void append(const char* t) { insert(length(), t); }
@@ -210,20 +210,20 @@
    */
    void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
 
-    char* line_text(int pos);
-    int line_start(int pos);
-    int line_end(int pos);
-    int word_start(int pos);
-    int word_end(int pos);
-    int expand_character(int pos, int indent, char *outStr);
+    char* line_text(int pos) const;
+    int line_start(int pos) const;
+    int line_end(int pos) const;
+    int word_start(int pos) const;
+    int word_end(int pos) const;
+    int expand_character(int pos, int indent, char *outStr) const;
 
     static int expand_character(char c, int indent, char* outStr, int tabDist,
                                 char nullSubsChar);
 
     static int character_width(char c, int indent, int tabDist, char 
nullSubsChar);
-    int count_displayed_characters(int lineStartPos, int targetPos);
+    int count_displayed_characters(int lineStartPos, int targetPos) const;
     int skip_displayed_characters(int lineStartPos, int nChars);
-    int count_lines(int startPos, int endPos);
+    int count_lines(int startPos, int endPos) const;
     int skip_lines(int startPos, int nLines);
     int rewind_lines(int startPos, int nLines);
     int findchar_forward(int startPos, char searchChar, int* foundPos) const;
@@ -240,7 +240,7 @@
     int substitute_null_characters(char* string, int length);
     void unsubstitute_null_characters(char* string);
     /**    Returns the current nul substitution character.  */
-    char null_substitution_character() { return mNullSubsChar; }
+    char null_substitution_character() const { return mNullSubsChar; }
     /**    Returns the primary selection.  */
     Fl_Text_Selection* primary_selection() { return &mPrimary; }
     /**    Returns the secondary selection.  */
@@ -250,8 +250,8 @@
 
   protected:
     void call_modify_callbacks(int pos, int nDeleted, int nInserted,
-                               int nRestyled, const char* deletedText);
-    void call_predelete_callbacks(int pos, int nDeleted);
+                               int nRestyled, const char* deletedText) const;
+    void call_predelete_callbacks(int pos, int nDeleted) const;
 
     int insert_(int pos, const char* text);
     void remove_(int start, int end);
@@ -267,17 +267,17 @@
                               int* nInserted, int* endPos);
 
     void redisplay_selection(Fl_Text_Selection* oldSelection,
-                             Fl_Text_Selection* newSelection);
+                             Fl_Text_Selection* newSelection) const;
 
     void move_gap(int pos);
     void reallocate_with_gap(int newGapStart, int newGapLen);
-    char* selection_text_(Fl_Text_Selection* sel);
+    char* selection_text_(Fl_Text_Selection* sel) const;
     void remove_selection_(Fl_Text_Selection* sel);
     void replace_selection_(Fl_Text_Selection* sel, const char* text);
 
     void rectangular_selection_boundaries(int lineStartPos, int rectStart,
                                           int rectEnd, int* selStart,
-                                          int* selEnd);
+                                          int* selEnd) const;
 
     void update_selections(int pos, int nDeleted, int nInserted);
 

Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-03 23:54:34 UTC (rev 
6819)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-04 00:06:32 UTC (rev 
6820)
@@ -557,7 +557,7 @@
   with the text, free it using the free() function.
 */
 char * Fl_Text_Buffer::text_in_rectangle(int start, int end,
-    int rectStart, int rectEnd) {
+    int rectStart, int rectEnd) const {
   int lineStart, selLeft, selRight, len;
   char *textOut, *outPtr, *retabbedStr;
   const char *textIn;
@@ -916,12 +916,12 @@
   character position. When you are done with the text, free it
   using the free() function.
 */
-char * Fl_Text_Buffer::line_text(int pos) {
+char * Fl_Text_Buffer::line_text(int pos) const {
   return text_range(line_start(pos), line_end(pos));
 }
 
 /** Returns the position of the start of the line containing position \p pos. 
*/
-int Fl_Text_Buffer::line_start(int pos) {
+int Fl_Text_Buffer::line_start(int pos) const {
   if (!findchar_backward(pos, '\n', &pos))
     return 0;
   return pos + 1;
@@ -931,13 +931,13 @@
    (which is either a pointer to the newline character ending the line,
    or a pointer to one character beyond the end of the buffer)
 */
-int Fl_Text_Buffer::line_end(int pos) {
+int Fl_Text_Buffer::line_end(int pos) const {
   if (!findchar_forward(pos, '\n', &pos))
     pos = mLength;
   return pos;
 }
 /** Returns the position corresponding to the start of the word */
-int Fl_Text_Buffer::word_start(int pos) {
+int Fl_Text_Buffer::word_start(int pos) const {
   while (pos && (isalnum(character(pos)) || character(pos) == '_')) {
     pos--;
   }
@@ -946,7 +946,7 @@
 }
 
 /**  Returns the position corresponding to the end of the word.*/
-int Fl_Text_Buffer::word_end(int pos) {
+int Fl_Text_Buffer::word_end(int pos) const {
   while (pos < length() && (isalnum(character(pos)) || character(pos) == '_')) 
{
     pos++;
   }
@@ -963,7 +963,7 @@
    for figuring tabs.  Output string is guranteed to be shorter or
    equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
 */
-int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) {
+int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) const {
   int ret;
   char c = character(pos);
   ret = expand_character(c, indent, outStr,
@@ -1058,7 +1058,7 @@
    shown on the screen to represent characters in the buffer, where tabs and
    control characters are expanded)
 */
-int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int 
targetPos) {
+int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int 
targetPos) const {
   int pos, charCount = 0;
   char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
 
@@ -1092,7 +1092,7 @@
    Counts the number of newlines between \p startPos and \p endPos in buffer.
    The character at position \p endPos is not counted.
 */
-int Fl_Text_Buffer::count_lines(int startPos, int endPos) {
+int Fl_Text_Buffer::count_lines(int startPos, int endPos) const {
   int pos, gapLen = mGapEnd - mGapStart;
   int lineCount = 0;
 
@@ -2012,7 +2012,7 @@
 
 
 
-char * Fl_Text_Buffer::selection_text_(Fl_Text_Selection *sel) {
+char * Fl_Text_Buffer::selection_text_(Fl_Text_Selection *sel) const {
   int start, end, isRect, rectStart, rectEnd;
   char *s;
 
@@ -2098,7 +2098,7 @@
    changed area(s) on the screen and any other listeners.
 */
 void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
-    int nInserted, int nRestyled, const char *deletedText) {
+    int nInserted, int nRestyled, const char *deletedText) const {
   int i;
 
   for (i = 0; i < mNModifyProcs; i++)
@@ -2110,7 +2110,7 @@
    Calls the stored pre-delete callback procedure(s) for this buffer to update 
    the changed area(s) on the screen and any other listeners.
 */
-void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) {
+void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) const {
     int i;
     
     for (i=0; i<mNPredeleteProcs; i++)
@@ -2122,7 +2122,7 @@
    screen for a change in a selection.
 */
 void Fl_Text_Buffer::redisplay_selection(Fl_Text_Selection *oldSelection,
-    Fl_Text_Selection *newSelection) {
+    Fl_Text_Selection *newSelection) const {
   int oldStart, oldEnd, newStart, newEnd, ch1Start, ch1End, ch2Start, ch2End;
 
   /* If either selection is rectangular, add an additional character to
@@ -2399,7 +2399,7 @@
    margin for subsequent columnar pastes of this data.
 */
 void Fl_Text_Buffer::rectangular_selection_boundaries(int lineStartPos,
-    int rectStart, int rectEnd, int *selStart, int *selEnd) {
+    int rectStart, int rectEnd, int *selStart, int *selEnd) const {
   int pos, width, indent = 0;
   char c;
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to