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
This commit is contained in:
parent
ff83e355b0
commit
2de2f54968
@ -91,6 +91,13 @@ public:
|
||||
virtual void remove_timeout(Fl_Timeout_Handler cb, void *argp) = 0;
|
||||
|
||||
static int secret_input_character;
|
||||
/* Implement to indicate whether complex text input may involve marked text.
|
||||
When it does, has_marked_text returns non zero and reset_marked_text() and
|
||||
insertion_point_location() must also be implemented.
|
||||
*/
|
||||
virtual int has_marked_text() { return 0; }
|
||||
virtual void reset_marked_text() {}
|
||||
virtual void insertion_point_location(int x, int y, int height) {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -129,13 +129,6 @@ public:
|
||||
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
|
||||
// implement to shield fprintf() from locale changes in decimal point
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
/* Implement to indicate whether complex text input may involve marked text.
|
||||
When it does, has_marked_text returns non zero and reset_marked_text() and
|
||||
insertion_point_location() must also be implemented.
|
||||
*/
|
||||
virtual int has_marked_text() { return 0; }
|
||||
virtual void reset_marked_text() {}
|
||||
virtual void insertion_point_location(int x, int y, int height) {}
|
||||
};
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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$".
|
||||
|
@ -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
|
||||
|
@ -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 ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user