From b4438b2fbe895694be98e6e8426103deefc51448 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 21 Jan 2025 21:04:54 +1300 Subject: Split public API and private implementation files into different directories --- body/c_fl_text_buffer.cpp | 296 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 body/c_fl_text_buffer.cpp (limited to 'body/c_fl_text_buffer.cpp') diff --git a/body/c_fl_text_buffer.cpp b/body/c_fl_text_buffer.cpp new file mode 100644 index 0000000..2322984 --- /dev/null +++ b/body/c_fl_text_buffer.cpp @@ -0,0 +1,296 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#include +#include "c_fl_text_buffer.h" + + + + +class My_Text_Buffer : public Fl_Text_Buffer { +public: + using Fl_Text_Buffer::Fl_Text_Buffer; + int reference_count = 0; +}; + + + + +TEXTBUFFER new_fl_text_buffer(int rs, int pgs) { + My_Text_Buffer *tb = new My_Text_Buffer(rs, pgs); + return tb; +} + +void upref_fl_text_buffer(TEXTBUFFER tb) { + static_cast(tb)->reference_count += 1; +} + +void free_fl_text_buffer(TEXTBUFFER tb) { + if (static_cast(tb)->reference_count <= 0) { + delete static_cast(tb); + } else { + static_cast(tb)->reference_count -= 1; + } +} + + + + +void fl_text_buffer_add_modify_callback(TEXTBUFFER tb, void * cb, void * ud) { + static_cast(tb)->add_modify_callback + (reinterpret_cast(cb), ud); +} + +void fl_text_buffer_add_predelete_callback(TEXTBUFFER tb, void * cb, void * ud) { + static_cast(tb)->add_predelete_callback + (reinterpret_cast(cb), ud); +} + +void fl_text_buffer_call_modify_callbacks(TEXTBUFFER tb) { + static_cast(tb)->call_modify_callbacks(); +} + +void fl_text_buffer_call_predelete_callbacks(TEXTBUFFER tb) { + static_cast(tb)->call_predelete_callbacks(); +} + + + + +int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n, int b) { + return static_cast(tb)->loadfile(n,b); +} + +int fl_text_buffer_appendfile(TEXTBUFFER tb, char * n, int b) { + return static_cast(tb)->appendfile(n,b); +} + +int fl_text_buffer_insertfile(TEXTBUFFER tb, char * n, int p, int b) { + return static_cast(tb)->insertfile(n,p,b); +} + +int fl_text_buffer_outputfile(TEXTBUFFER tb, char * n, int f, int t, int b) { + return static_cast(tb)->outputfile(n,f,t,b); +} + +int fl_text_buffer_savefile(TEXTBUFFER tb, char * n, int b) { + return static_cast(tb)->savefile(n,b); +} + + + + +void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item) { + static_cast(tb)->insert(p, item); +} + +void fl_text_buffer_append(TEXTBUFFER tb, const char * item) { + static_cast(tb)->append(item); +} + +void fl_text_buffer_replace(TEXTBUFFER tb, int s, int f, const char * text) { + static_cast(tb)->replace(s, f, text); +} + +void fl_text_buffer_remove(TEXTBUFFER tb, int s, int f) { + static_cast(tb)->remove(s, f); +} + +char * fl_text_buffer_get_text(TEXTBUFFER tb) { + return static_cast(tb)->text(); +} + +void fl_text_buffer_set_text(TEXTBUFFER tb, char * t) { + static_cast(tb)->text(t); +} + +char fl_text_buffer_byte_at(TEXTBUFFER tb, int p) { + return static_cast(tb)->byte_at(p); +} + +unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p) { + return static_cast(tb)->char_at(p); +} + +char * fl_text_buffer_text_range(TEXTBUFFER tb, int s, int f) { + return static_cast(tb)->text_range(s, f); +} + +int fl_text_buffer_next_char(TEXTBUFFER tb, int p) { + return static_cast(tb)->next_char(p); +} + +int fl_text_buffer_prev_char(TEXTBUFFER tb, int p) { + return static_cast(tb)->prev_char(p); +} + + + + +int fl_text_buffer_count_displayed_characters(TEXTBUFFER tb, int s, int f) { + return static_cast(tb)->count_displayed_characters(s,f); +} + +int fl_text_buffer_count_lines(TEXTBUFFER tb, int s, int f) { + return static_cast(tb)->count_lines(s,f); +} + +int fl_text_buffer_length(TEXTBUFFER tb) { + return static_cast(tb)->length(); +} + +int fl_text_buffer_get_tab_distance(TEXTBUFFER tb) { + return static_cast(tb)->tab_distance(); +} + +void fl_text_buffer_set_tab_distance(TEXTBUFFER tb, int t) { + static_cast(tb)->tab_distance(t); +} + + + + +int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e) { + return static_cast(tb)->selection_position(s, e); +} + +int fl_text_buffer_secondary_selection_position(TEXTBUFFER tb, int * s, int * e) { + return static_cast(tb)->secondary_selection_position(s,e); +} + +void fl_text_buffer_select(TEXTBUFFER tb, int s, int e) { + static_cast(tb)->select(s, e); +} + +void fl_text_buffer_secondary_select(TEXTBUFFER tb, int s, int e) { + static_cast(tb)->secondary_select(s,e); +} + +int fl_text_buffer_selected(TEXTBUFFER tb) { + return static_cast(tb)->selected(); +} + +int fl_text_buffer_secondary_selected(TEXTBUFFER tb) { + return static_cast(tb)->secondary_selected(); +} + +char * fl_text_buffer_selection_text(TEXTBUFFER tb) { + return static_cast(tb)->selection_text(); +} + +char * fl_text_buffer_secondary_selection_text(TEXTBUFFER tb) { + return static_cast(tb)->secondary_selection_text(); +} + +void fl_text_buffer_replace_selection(TEXTBUFFER tb, char * t) { + static_cast(tb)->replace_selection(t); +} + +void fl_text_buffer_replace_secondary_selection(TEXTBUFFER tb, char * t) { + static_cast(tb)->replace_secondary_selection(t); +} + +void fl_text_buffer_remove_selection(TEXTBUFFER tb) { + static_cast(tb)->remove_selection(); +} + +void fl_text_buffer_remove_secondary_selection(TEXTBUFFER tb) { + static_cast(tb)->remove_secondary_selection(); +} + +void fl_text_buffer_unselect(TEXTBUFFER tb) { + static_cast(tb)->unselect(); +} + +void fl_text_buffer_secondary_unselect(TEXTBUFFER tb) { + static_cast(tb)->secondary_unselect(); +} + + + + +void fl_text_buffer_highlight(TEXTBUFFER tb, int f, int t) { + static_cast(tb)->highlight(f,t); +} + +char * fl_text_buffer_highlight_text(TEXTBUFFER tb) { + return static_cast(tb)->highlight_text(); +} + +void fl_text_buffer_unhighlight(TEXTBUFFER tb) { + static_cast(tb)->unhighlight(); +} + + + + +int fl_text_buffer_findchar_forward(TEXTBUFFER tb, int start, unsigned int item, int * found) { + return static_cast(tb)->findchar_forward(start, item, found); +} + +int fl_text_buffer_findchar_backward(TEXTBUFFER tb, int start, unsigned int item, int * found) { + return static_cast(tb)->findchar_backward(start, item, found); +} + +int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { + return static_cast(tb)->search_forward(start, item, found, mcase); +} + +int fl_text_buffer_search_backward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { + return static_cast(tb)->search_backward(start, item, found, mcase); +} + + + + +int fl_text_buffer_word_start(TEXTBUFFER tb, int p) { + return static_cast(tb)->word_start(p); +} + +int fl_text_buffer_word_end(TEXTBUFFER tb, int p) { + return static_cast(tb)->word_end(p); +} + +int fl_text_buffer_line_start(TEXTBUFFER tb, int p) { + return static_cast(tb)->line_start(p); +} + +int fl_text_buffer_line_end(TEXTBUFFER tb, int p) { + return static_cast(tb)->line_end(p); +} + +char * fl_text_buffer_line_text(TEXTBUFFER tb, int p) { + return static_cast(tb)->line_text(p); +} + +int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) { + return static_cast(tb)->skip_lines(s, l); +} + +int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l) { + return static_cast(tb)->rewind_lines(s, l); +} + +int fl_text_buffer_skip_displayed_characters(TEXTBUFFER tb, int s, int n) { + return static_cast(tb)->skip_displayed_characters(s,n); +} + + + + +void fl_text_buffer_canundo(TEXTBUFFER tb, char f) { + return static_cast(tb)->canUndo(f); +} + +void fl_text_buffer_copy(TEXTBUFFER tb, TEXTBUFFER tb2, int s, int f, int i) { + static_cast(tb)->copy(static_cast(tb2),s,f,i); +} + +int fl_text_buffer_utf8_align(TEXTBUFFER tb, int p) { + return static_cast(tb)->utf8_align(p); +} + + -- cgit