From e644b575c5f7ae9b78df2bb6985ec352a7c0f0e0 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sat, 1 Feb 2025 23:49:05 +1300 Subject: Filled holes in Fl_Text_Display API, fixed some Shortcut subprogram inconsistencies --- doc/fl_button.html | 4 +- doc/fl_input_.html | 8 +- doc/fl_text_display.html | 627 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 603 insertions(+), 36 deletions(-) (limited to 'doc') diff --git a/doc/fl_button.html b/doc/fl_button.html index cc7b94d..05838b5 100644 --- a/doc/fl_button.html +++ b/doc/fl_button.html @@ -176,7 +176,7 @@ int shortcut() const;
 function Get_Shortcut
        (This : in Button)
-    return Shortcut_Key;
+    return Key_Combo;
 
@@ -187,7 +187,7 @@ void shortcut(int s);
 procedure Set_Shortcut
        (This : in out Button;
-        Key  : in     Shortcut_Key);
+        Key  : in     Key_Combo);
 
diff --git a/doc/fl_input_.html b/doc/fl_input_.html index 071ec66..e9edf37 100644 --- a/doc/fl_input_.html +++ b/doc/fl_input_.html @@ -392,9 +392,9 @@ procedure Resize int shortcut() const;
-function Get_Shortcut_Key
+function Get_Shortcut
        (This : in Input)
-    return Shortcut_Key;
+    return Key_Combo;
 
@@ -403,9 +403,9 @@ function Get_Shortcut_Key void shortcut(int s);
-procedure Set_Shortcut_Key
+procedure Set_Shortcut
        (This : in out Input;
-        To   : in     Shortcut_Key);
+        To   : in     Key_Combo);
 
diff --git a/doc/fl_text_display.html b/doc/fl_text_display.html index e37622c..8d0d20a 100644 --- a/doc/fl_text_display.html +++ b/doc/fl_text_display.html @@ -48,7 +48,7 @@ enum { CURSOR_POS, CHARACTER_POS } -   + Position_Kind @@ -72,15 +72,25 @@ -   + uchar Style_Index -   + Style_Table_Entry * Style_Array + + int + Style_Mask + + + + int + Style_Info + + @@ -135,6 +145,7 @@ function Create
 void buffer(Fl_Text_Buffer *buf);
+
 void buffer(Fl_Text_Buffer &buf);
 
@@ -169,7 +180,8 @@ function Col_To_X
 
   
 
-int count_lines(int start, int end, bool start_pos_is_line_start) const;
+int count_lines(int start, int end,
+    bool start_pos_is_line_start) const;
 
 function Count_Lines
@@ -305,20 +317,10 @@ function Get_Insert_Position
 
- -  -
-function Item
-       (Tint : in Color;
-        Font : in Font_Kind;
-        Size : in Font_Size)
-    return Style_Entry;
-
- -
-int line_end(int startPos, bool startPosIsLineStart) const;
+int line_end(int startPos,
+    bool startPosIsLineStart) const;
 
 function Line_End
@@ -431,16 +433,24 @@ function Get_Linenumber_Font
 
   
 
-void linenumber_format(const char *val);
+const char * linenumber_format() const;
+
+
+function Get_Linenumber_Format
+       (This : in Text_Display)
+    return String;
 
-const char * linenumber_format() const;
+void linenumber_format(const char *val);
+
+
+procedure Set_Linenumber_Format
+       (This  : in out Text_Display;
+        Value : in     String);
 
-  @@ -494,6 +504,10 @@ int move_down();
 procedure Move_Down
        (This : in out Text_Display);
+
+function Move_Down
+       (This : in out Text_Display)
+    return Boolean;
 
@@ -504,6 +518,10 @@ int move_left();
 procedure Move_Left
        (This : in out Text_Display);
+
+function Move_Left
+       (This : in out Text_Display)
+    return Boolean;
 
@@ -514,6 +532,10 @@ int move_right();
 procedure Move_Right
        (This : in out Text_Display);
+
+function Move_Right
+       (This : in out Text_Display)
+    return Boolean;
 
@@ -524,6 +546,10 @@ int move_up();
 procedure Move_Up
        (This : in out Text_Display);
+
+function Move_Up
+       (This : in out Text_Display)
+    return Boolean;
 
@@ -550,9 +576,17 @@ procedure Overstrike
-int position_style(int lineStartPos, int lineLen, int lineIndex) const;
+int position_style(int lineStartPos, int lineLen,
+    int lineIndex) const;
+
+
+function Position_Style
+       (This        : in Text_Display;
+        Line_Start  : in Natural;
+        Line_Length : in Natural;
+        Line_Index  : in Natural)
+    return Styles.Style_Info;
 
-  @@ -593,7 +627,11 @@ procedure Redisplay_Range
 virtual void resize(int X, int Y, int W, int H);
 
-  +
+procedure Resize
+       (This       : in out Text_Display;
+        X, Y, W, H : in     Integer);
+
@@ -614,8 +652,9 @@ void scroll(int topLineNum, int horizOffset);
 procedure Scroll_To
-       (This : in out Text_Display;
-        Line : in     Natural);
+       (This   : in out Text_Display;
+        Line   : in     Natural;
+        Column : in     Natural := 0);
 
@@ -667,14 +706,22 @@ procedure Set_Scrollbar_Width
 int shortcut() const;
 
-  +
+function Get_Shortcut
+       (This : in Text_Display)
+    return Key_Combo;
+
 void shortcut(int s);
 
-  +
+procedure Set_Shortcut
+       (This  : in out Text_Display;
+        Value : in     Key_Combo);
+
@@ -699,7 +746,8 @@ procedure Show_Insert_Position
-int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
+int skip_lines(int startPos, int nLines,
+    bool startPosIsLineStart);
 
 function Skip_Lines
@@ -816,14 +864,24 @@ procedure Set_Wrap_Mode
 
 int wrapped_column(int row, int column) const;
 
-  +
+function Wrapped_Column
+       (This        : in Text_Display;
+        Row, Column : in Natural)
+    return Natural;
+
 int wrapped_row(int row) const;
 
-  +
+function Wrapped_Row
+       (This : in Text_Display;
+        Row  : in Natural)
+    return Natural;
+
@@ -845,6 +903,54 @@ function X_To_Col + + + + + + + + + + + + + + + + + + + + + + + + +
Static Protected Functions and Procedures
+static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
+    int nRestyled, const char *deletedText, void *cbArg);
+
+procedure Buffer_Modified_Callback
+       (This         : in out Text_Display;
+        Action       : in     FLTK.Text_Buffers.Modification;
+        Place        : in     FLTK.Text_Buffers.Position;
+        Length       : in     Natural;
+        Deleted_Text : in     String);
+
+static void buffer_predelete_cb(int pos, int nDeleted, void *cbArg);
+
+procedure Buffer_Predelete_Callback
+       (This   : in out Text_Display;
+        Place  : in     FLTK.Text_Buffers.Position;
+        Length : in     Natural);
+
+static void h_scrollbar_cb(Fl_Scrollbar *w, Fl_Text_Display *d);
+
Intentionally left unbound.
+static void scroll_timer_cb(void *);
+
Intentionally left unbound.
+static void v_scrollbar_cb(Fl_Scrollbar *w, Fl_Text_Display *d);
+
Intentionally left unbound.
@@ -854,6 +960,61 @@ function X_To_Col
+void absolute_top_line_number(int oldFirstChar);
+
+
+procedure Redo_Absolute_Top_Line
+       (This      : in out Text_Display;
+        Old_First : in     Natural);
+
+ + + +
+void calc_last_char();
+
+
+procedure Calculate_Last_Character
+       (This : in out Text_Display);
+
+ + + +
+void calc_line_starts(int startLine, int endLine);
+
+
+procedure Calculate_Line_Starts
+       (This          : in out Text_Display;
+        Start, Finish : in     Natural);
+
+ + + +
+void clear_rect(int style, int x, int y, int width,
+    int height) const;
+
+
+procedure Clear_Rect
+       (This       : in out Text_Display;
+        Style      : in     Styles.Style_Info;
+        X, Y, W, H : in     Integer);
+
+ + + +
+void display_insert();
+
+
+procedure Display_Insert
+       (This : in out Text_Display);
+
+ + + +
 virtual void draw();
 
@@ -862,6 +1023,412 @@ procedure Draw
 
+ +
+void draw_cursor(int, int);
+
+
+procedure Draw_Cursor
+       (This : in out Text_Display;
+        X, Y : in     Integer);
+
+ + + +
+void draw_line_numbers(bool clearAll);
+
+
+procedure Draw_Line_Numbers
+       (This  : in out Text_Display;
+        Clear : in     Boolean :=  False);
+
+ + + +
+void draw_range(int start, int end);
+
+
+procedure Draw_Range
+       (This          : in out Text_Display;
+        Start, Finish : in     Natural);
+
+ + + +
+void draw_string(int style, int x, int y, int toX,
+    const char *string, int nChars) const;
+
+
+procedure Draw_String
+       (This      : in out Text_Display;
+        Style     : in     Styles.Style_Info;
+        X, Y      : in     Integer;
+        Right     : in     Integer;
+        Text      : in     String;
+        Num_Chars : in     Natural);
+
+ + + +
+void draw_text(int x, int y, int w, int h);
+
+
+procedure Draw_Text
+       (This       : in out Text_Display;
+        X, Y, W, H : in     Integer);
+
+ + + +
+void draw_vline(int visLineNum, int leftClip, int rightClip,
+    int leftCharIndex, int rightCharIndex);
+
+
+procedure Draw_Visible_Line
+       (This                  : in out Text_Display;
+        Line                  : in     Natural;
+        Left_Clip, Right_Clip : in     Integer;
+        Left_Char, Right_Char : in     Natural);
+
+ + + +
+int empty_vlines() const;
+
+
+function Has_Empty_Visible_Lines
+       (This : in Text_Display)
+    return Boolean;
+
+ + + +
+void extend_range_for_styles(int *start, int *end);
+
+Intentionally left unbound. + + + +
+void find_line_end(int pos, bool start_pos_is_line_start,
+    int *lineEnd, int *nextLineStart) const;
+
+
+procedure Find_Line_End
+       (This                    : in     Text_Display;
+        Start                   : in     Natural;
+        Start_Pos_Is_Line_Start : in     Boolean;
+        Line_End                :    out Natural;
+        Next_Line_Start         :    out Natural);
+
+ + + +
+void find_wrap_range(const char *deletedText, int pos,
+    int nInserted, int nDeleted, int *modRangeStart,
+    int *modRangeEnd, int *linesInserted, int *linesDeleted);
+
+Intentionally left unbound. + + + +
+int find_x(const char *s, int len, int style, int x) const;
+
+
+function Find_Character
+       (This  : in Text_Display;
+        Text  : in String;
+        Style : in Styles.Style_Index;
+        X     : in Integer)
+    return Natural;
+
+ + + +
+int get_absolute_top_line_number() const;
+
+
+function Get_Absolute_Top_Line
+       (This : in Text_Display)
+    return Natural;
+
+ + + +
+int handle_vline(int mode, int lineStart, int lineLen,
+    int leftChar, int rightChar, int topClip, int bottomClip,
+    int leftClip, int rightClip) const;
+
+Intentionally left unbound. + + + +
+int longest_vline() const;
+
+
+function Get_Longest_Visible_Line
+       (This : in Text_Display)
+    return Natural;
+
+ + + +
+void maintain_absolute_top_line_number(int state);
+
+
+procedure Maintain_Absolute_Top_Line
+       (This  : in out Text_Display;
+        State : in     Boolean := True);
+
+ + + +
+int maintaining_absolute_top_line_number() const;
+
+
+function Maintaining_Absolute_Top_Line
+       (This : in Text_Display)
+    return Boolean;
+
+ + + +
+void measure_deleted_lines(int pos, int nDeleted);
+
+Intentionally left unbound. + + + +
+double measure_proportional_character(const char *s, int colNum,
+    int pos) const;
+
+
+function Measure_Character
+       (This  : in Text_Display;
+        Text  : in String;
+        X     : in Integer;
+        Index : in Positive)
+    return Long_Float;
+
+ + + +
+int measure_vline(int visLineNum) const;
+
+
+function Measure_Visible_Line
+       (This : in Text_Display;
+        Line : in Natural)
+    return Natural;
+
+ + + +
+void offset_line_starts(int newTopLineNum);
+
+
+procedure Offset_Line_Starts
+       (This    : in out Text_Display;
+        New_Top : in     Natural);
+
+ + + +
+int position_to_line(int pos, int *lineNum) const;
+
+
+function Position_To_Line
+       (This     : in Text_Display;
+        Position : in Natural)
+    return Natural;
+
+function Position_To_Line
+       (This      : in     Text_Display;
+        Position  : in     Natural;
+        Displayed :    out Boolean)
+    return Natural;
+
+ + + +
+int position_to_linecol(int pos, int *lineNum, int *column) const;
+
+
+procedure Position_To_Line_Column
+       (This     : in     Text_Display;
+        Position : in     Natural;
+        Line     :    out Natural;
+        Column   :    out Natural);
+
+procedure Position_To_Line_Column
+       (This      : in     Text_Display;
+        Position  : in     Natural;
+        Line      :    out Natural;
+        Column    :    out Natural;
+        Displayed :    out Boolean);
+
+ + + +
+void reset_absolute_top_line_number();
+
+
+procedure Reset_Absolute_Top_Line
+       (This : in out Text_Display);
+
+ + + +
+int scroll_(int topLineNum, int horizOffset);
+
+
+function Scroll_To
+       (This  : in out Text_Display;
+        Line  : in     Natural;
+        Pixel : in     Natural := 0)
+    return Boolean;
+
+ + + +
+double string_width(const char *string, int length,
+    int style) const;
+
+
+function Measure_String
+       (This  : in Text_Display;
+        Text  : in String;
+        Style : in Styles.Style_Index)
+    return Long_Float;
+
+ + + +
+void update_h_scrollbar();
+
+
+procedure Update_Horizontal_Scrollbar
+       (This : in out Text_Display);
+
+ + + +
+void update_line_starts(int pos, int charsInserted,
+    int charsDeleted, int linesInserted, int linesDeleted,
+    int *scrolled);
+
+Intentionally left unbound. + + + +
+void update_v_scrollbar();
+
+
+procedure Update_Vertical_Scrollbar
+       (This : in out Text_Display);
+
+ + + +
+int vline_length(int visLineNum) const;
+
+
+function Visible_Line_Length
+       (This : in Text_Display;
+        Line : in Natural)
+    return Natural;
+
+ + + +
+int wrap_uses_character(int lineEndPos) const;
+
+
+function Wrap_Uses_Character
+       (This     : in Text_Display;
+        Line_End : in Natural)
+    return Boolean;
+
+ + + +
+void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
+    int maxPos, int maxLines, bool startPosIsLineStart,
+    int styleBufOffset, int *retPos, int *retLines,
+    int *retLineStart, int *retLineEnd,
+    bool countLastLineMissingNewLine=true) const;
+
+
+procedure Count_Wrapped_Lines
+       (This                       : in     Text_Display;
+        Buffer                     : in     FLTK.Text_Buffers.Text_Buffer;
+        Start                      : in     Natural;
+        Max_Position, Max_Lines    : in     Natural;
+        Start_Pos_Is_Line_Start    : in     Boolean;
+        Style_Offset               : in     Natural;
+        Finish, Line_Count         :    out Natural;
+        End_Count_Line_Start       :    out Natural;
+        Last_Line_End              :    out Natural;
+        Count_Last_Missing_Newline : in     Boolean := True);
+
+ + + +
+int xy_to_position(int x, int y, int PosType=CHARACTER_POS) const;
+
+
+function XY_To_Position
+       (This : in Text_Display;
+        X, Y : in Integer;
+        Kind : in Position_Kind := Character_Position)
+    return Natural;
+
+ + + +
+void xy_to_rowcol(int x, int y, int *row, int *column,
+    int PosType=CHARACTER_POS) const;
+
+
+procedure XY_To_Row_Column
+       (This        : in     Text_Display;
+        X, Y        : in     Integer;
+        Row, Column :    out Natural;
+        Kind        : in     Position_Kind := Character_Position);
+
+ + -- cgit