diff options
| author | Manolo Gouy <Manolo> | 2016-03-31 17:25:18 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-31 17:25:18 +0000 |
| commit | 2de2f5496820f91c81df65834eee268126086209 (patch) | |
| tree | 1ee88071287b849a08467bee48f7c281b38d1bae /src | |
| parent | ff83e355b09f07848257d8fef7a12705347955cc (diff) | |
Move the marked text support member functions from Fl_System_Driver to Fl_Screen_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11486 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Input.cxx | 3 | ||||
| -rw-r--r-- | src/Fl_Text_Editor.cxx | 3 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 33 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 32 |
7 files changed, 42 insertions, 39 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 8c66965d8..9e56971f5 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1883,11 +1883,11 @@ int Fl::dnd() } void Fl::reset_marked_text() { - Fl_System_Driver::driver()->reset_marked_text(); + Fl::screen_driver()->reset_marked_text(); } void Fl::insertion_point_location(int x, int y, int height) { // sets window coordinates & height of insertion point - Fl_System_Driver::driver()->insertion_point_location(x, y, height); + Fl::screen_driver()->insertion_point_location(x, y, height); } // diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 92daee5bd..25329b694 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -35,6 +35,7 @@ #include <FL/x.H> #include <FL/Fl_Window.H> #include <FL/Fl_System_Driver.H> +#include <FL/Fl_Screen_Driver.H> #include <FL/Fl_Input.H> #include <FL/fl_draw.H> #include <FL/fl_ask.H> @@ -600,7 +601,7 @@ int Fl_Input::handle(int event) { static Fl_Widget *dnd_save_focus = NULL; switch (event) { case FL_UNFOCUS: - if (Fl_System_Driver::driver()->has_marked_text() && Fl::compose_state) { + if (Fl::screen_driver()->has_marked_text() && Fl::compose_state) { this->mark( this->position() ); Fl::reset_marked_text(); } diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx index c43fb518c..5e4735866 100644 --- a/src/Fl_Text_Editor.cxx +++ b/src/Fl_Text_Editor.cxx @@ -23,6 +23,7 @@ #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Text_Editor.H> +#include <FL/Fl_Screen_Driver.H> #include <FL/fl_ask.H> #if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform editor @@ -586,7 +587,7 @@ int Fl_Text_Editor::handle(int event) { case FL_UNFOCUS: show_cursor(mCursorOn); // redraws the cursor - if (Fl_System_Driver::driver()->has_marked_text() && buffer()->selected() && Fl::compose_state) { + if (Fl::screen_driver()->has_marked_text() && buffer()->selected() && Fl::compose_state) { int pos = insert_position(); buffer()->select(pos, pos); Fl::reset_marked_text(); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index ca9ef3ae6..ff0dcb062 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -76,6 +76,9 @@ public: virtual void repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp); virtual int has_timeout(Fl_Timeout_Handler cb, void *argp); virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp); + virtual int has_marked_text(); + virtual void reset_marked_text(); + virtual void insertion_point_location(int x, int y, int height); }; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 2d2d6675b..0e8f480d1 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -230,6 +230,39 @@ const char *Fl_Cocoa_Screen_Driver::get_system_scheme() } +int Fl_Cocoa_Screen_Driver::has_marked_text() { + return true; +} + + +static int insertion_point_x = 0; +static int insertion_point_y = 0; +static int insertion_point_height = 0; +static bool insertion_point_location_is_valid = false; + +void Fl_Cocoa_Screen_Driver::reset_marked_text() { + Fl::compose_state = 0; + Fl_X::next_marked_length = 0; + insertion_point_location_is_valid = false; +} + +int Fl_X::insertion_point_location(int *px, int *py, int *pheight) +// return true if the current coordinates of the insertion point are available +{ + if ( ! insertion_point_location_is_valid ) return false; + *px = insertion_point_x; + *py = insertion_point_y; + *pheight = insertion_point_height; + return true; +} + +void Fl_Cocoa_Screen_Driver::insertion_point_location(int x, int y, int height) { + insertion_point_location_is_valid = true; + insertion_point_x = x; + insertion_point_y = y; + insertion_point_height = height; +} + // // End of "$Id$". diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 6926487ba..bfb1a66ea 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -65,9 +65,6 @@ public: virtual int rmdir(const char* f) {return ::rmdir(f);} virtual int rename(const char* f, const char *n) {return ::rename(f, n);} virtual int clocale_printf(FILE *output, const char *format, va_list args); - virtual int has_marked_text(); - virtual void reset_marked_text(); - virtual void insertion_point_location(int x, int y, int height); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index f112b3c9f..e700dfdfc 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -59,38 +59,6 @@ int Fl_Darwin_System_Driver::arg_and_value(const char *name, const char *value) return strcmp(name, "NSDocumentRevisionsDebugMode") == 0; } -static int insertion_point_x = 0; -static int insertion_point_y = 0; -static int insertion_point_height = 0; -static bool insertion_point_location_is_valid = false; - -int Fl_Darwin_System_Driver::has_marked_text() { - return true; -} - -void Fl_Darwin_System_Driver::reset_marked_text() { - Fl::compose_state = 0; - Fl_X::next_marked_length = 0; - insertion_point_location_is_valid = false; -} - -int Fl_X::insertion_point_location(int *px, int *py, int *pheight) -// return true if the current coordinates of the insertion point are available -{ - if ( ! insertion_point_location_is_valid ) return false; - *px = insertion_point_x; - *py = insertion_point_y; - *pheight = insertion_point_height; - return true; -} - -void Fl_Darwin_System_Driver::insertion_point_location(int x, int y, int height) { - insertion_point_location_is_valid = true; - insertion_point_x = x; - insertion_point_y = y; - insertion_point_height = height; -} - int Fl_Darwin_System_Driver::compose(int &del) { int condition; int has_text_key = Fl::compose_state || Fl::e_keysym <= '~' || Fl::e_keysym == FL_Iso_Key || |
