diff options
-rw-r--r-- | c_fl_text_buffer.cpp | 10 | ||||
-rw-r--r-- | c_fl_text_buffer.h | 2 | ||||
-rw-r--r-- | c_fl_text_display.cpp | 10 | ||||
-rw-r--r-- | c_fl_text_display.h | 2 | ||||
-rw-r--r-- | fltk-dialogs.adb | 3 | ||||
-rw-r--r-- | fltk-dialogs.ads | 3 | ||||
-rw-r--r-- | fltk-text_buffers.adb | 40 | ||||
-rw-r--r-- | fltk-text_buffers.ads | 14 | ||||
-rw-r--r-- | fltk-widgets-groups-text_displays.adb | 42 | ||||
-rw-r--r-- | fltk-widgets-groups-text_displays.ads | 15 |
10 files changed, 139 insertions, 2 deletions
diff --git a/c_fl_text_buffer.cpp b/c_fl_text_buffer.cpp index 8b0cde1..a28286f 100644 --- a/c_fl_text_buffer.cpp +++ b/c_fl_text_buffer.cpp @@ -69,3 +69,13 @@ void fl_text_buffer_select(TEXTBUFFER tb, int s, int e) { reinterpret_cast<Fl_Text_Buffer*>(tb)->select(s, e); } + +int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->skip_lines(s, l); +} + + +int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->rewind_lines(s, l); +} + diff --git a/c_fl_text_buffer.h b/c_fl_text_buffer.h index 5a1ab08..ed95a6d 100644 --- a/c_fl_text_buffer.h +++ b/c_fl_text_buffer.h @@ -22,6 +22,8 @@ extern "C" void fl_text_buffer_remove_selection(TEXTBUFFER tb); extern "C" int fl_text_buffer_savefile(TEXTBUFFER tb, char * n); extern "C" int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase); extern "C" void fl_text_buffer_select(TEXTBUFFER tb, int s, int e); +extern "C" int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l); +extern "C" int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l); #endif diff --git a/c_fl_text_display.cpp b/c_fl_text_display.cpp index d1785e2..85ad733 100644 --- a/c_fl_text_display.cpp +++ b/c_fl_text_display.cpp @@ -88,3 +88,13 @@ void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m) { reinterpret_cast<Fl_Text_Display*>(td)->wrap_mode(w, m); } + +int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p) { + return reinterpret_cast<Fl_Text_Display*>(td)->skip_lines(s, l, p); +} + + +int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l) { + return reinterpret_cast<Fl_Text_Display*>(td)->rewind_lines(s, l); +} + diff --git a/c_fl_text_display.h b/c_fl_text_display.h index 2f8e089..3202397 100644 --- a/c_fl_text_display.h +++ b/c_fl_text_display.h @@ -26,6 +26,8 @@ extern "C" void fl_text_display_show_insert_pos(TEXTDISPLAY td); extern "C" void fl_text_display_next_word(TEXTDISPLAY td); extern "C" void fl_text_display_previous_word(TEXTDISPLAY td); extern "C" void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m); +extern "C" int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p); +extern "C" int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l); #endif diff --git a/fltk-dialogs.adb b/fltk-dialogs.adb index fed4070..0c9adcf 100644 --- a/fltk-dialogs.adb +++ b/fltk-dialogs.adb @@ -82,7 +82,8 @@ package body FLTK.Dialogs is function Text_Input - (Message, Default : in String) + (Message : in String; + Default : in String := "") return String is Result : Interfaces.C.Strings.chars_ptr := dialog_fl_input diff --git a/fltk-dialogs.ads b/fltk-dialogs.ads index cf8f80e..cb5b966 100644 --- a/fltk-dialogs.ads +++ b/fltk-dialogs.ads @@ -20,7 +20,8 @@ package FLTK.Dialogs is function Text_Input - (Message, Default : in String) + (Message : in String; + Default : in String := "") return String; diff --git a/fltk-text_buffers.adb b/fltk-text_buffers.adb index 7529c1c..ab752ff 100644 --- a/fltk-text_buffers.adb +++ b/fltk-text_buffers.adb @@ -84,6 +84,18 @@ package body FLTK.Text_Buffers is S, E : in Interfaces.C.int); pragma Import (C, fl_text_buffer_select, "fl_text_buffer_select"); + function fl_text_buffer_skip_lines + (TB : in System.Address; + S, L : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_buffer_skip_lines, "fl_text_buffer_skip_lines"); + + function fl_text_buffer_rewind_lines + (TB : in System.Address; + S, L : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_buffer_rewind_lines, "fl_text_buffer_rewind_lines"); + @@ -336,5 +348,33 @@ package body FLTK.Text_Buffers is end Set_Selection; + + + function Skip_Lines + (This : in out Text_Buffer; + Start, Lines : in Natural) + return Natural is + begin + return Natural (fl_text_buffer_skip_lines + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Lines))); + end Skip_Lines; + + + + + function Rewind_Lines + (This : in out Text_Buffer; + Start, Lines : in Natural) + return Natural is + begin + return Natural (fl_text_buffer_rewind_lines + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Lines))); + end Rewind_Lines; + + end FLTK.Text_Buffers; diff --git a/fltk-text_buffers.ads b/fltk-text_buffers.ads index a021dbf..5b260d6 100644 --- a/fltk-text_buffers.ads +++ b/fltk-text_buffers.ads @@ -91,6 +91,20 @@ package FLTK.Text_Buffers is Start, Finish : in Natural); + -- only takes into account newline characters, not word wrap + function Skip_Lines + (This : in out Text_Buffer; + Start, Lines : in Natural) + return Natural; + + + -- only takes into account newline characters, not word wrap + function Rewind_Lines + (This : in out Text_Buffer; + Start, Lines : in Natural) + return Natural; + + private diff --git a/fltk-widgets-groups-text_displays.adb b/fltk-widgets-groups-text_displays.adb index 71aeee0..c6a1589 100644 --- a/fltk-widgets-groups-text_displays.adb +++ b/fltk-widgets-groups-text_displays.adb @@ -85,6 +85,18 @@ package body FLTK.Widgets.Groups.Text_Displays is W, M : in Interfaces.C.int); pragma Import (C, fl_text_display_wrap_mode, "fl_text_display_wrap_mode"); + function fl_text_display_skip_lines + (TD : in System.Address; + S, L, P : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_display_skip_lines, "fl_text_display_skip_lines"); + + function fl_text_display_rewind_lines + (TD : in System.Address; + S, L : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_display_rewind_lines, "fl_text_display_rewind_lines"); + @@ -264,5 +276,35 @@ package body FLTK.Widgets.Groups.Text_Displays is end Set_Wrap_Mode; + + + function Skip_Lines + (This : in out Text_Display; + Start, Lines : in Natural; + Start_Pos_Is_Line_Start : in Boolean := False) + return Natural is + begin + return Natural (fl_text_display_skip_lines + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Lines), + Boolean'Pos (Start_Pos_Is_Line_Start))); + end Skip_Lines; + + + + + function Rewind_Lines + (This : in out Text_Display; + Start, Lines : in Natural) + return Natural is + begin + return Natural (fl_text_display_rewind_lines + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Lines))); + end Rewind_Lines; + + end FLTK.Widgets.Groups.Text_Displays; diff --git a/fltk-widgets-groups-text_displays.ads b/fltk-widgets-groups-text_displays.ads index a55b28f..6362160 100644 --- a/fltk-widgets-groups-text_displays.ads +++ b/fltk-widgets-groups-text_displays.ads @@ -87,6 +87,21 @@ package FLTK.Widgets.Groups.Text_Displays is Margin : in Natural := 0); + -- takes into account word wrap as well as newline characters + function Skip_Lines + (This : in out Text_Display; + Start, Lines : in Natural; + Start_Pos_Is_Line_Start : in Boolean := False) + return Natural; + + + -- takes into account word wrap as well as newline characters + function Rewind_Lines + (This : in out Text_Display; + Start, Lines : in Natural) + return Natural; + + private |