From 20b00f29ce8097565e329638e19a25ab16a86e16 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 1 Apr 2016 14:49:29 +0000 Subject: Rewrite Fl_Text_Editor.cxx under the driver model. Fl_Cocoa_Screen_Driver contains the Mac OS-specific text editor key bindings. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11497 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 1 + src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 0c0d64566..34bf6b6ce 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -53,6 +53,7 @@ protected: static int insertion_point_height; static bool insertion_point_location_is_valid; public: + Fl_Cocoa_Screen_Driver(); // --- display management // --- screen configuration virtual void init(); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 470aa2c77..6f616cb56 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -43,6 +43,29 @@ Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() return new Fl_Cocoa_Screen_Driver(); } +static Fl_Text_Editor::Key_Binding extra_bindings[] = { + // Define CMD+key accelerators... + { 'z', FL_COMMAND, Fl_Text_Editor::kf_undo ,0}, + { 'x', FL_COMMAND, Fl_Text_Editor::kf_cut ,0}, + { 'c', FL_COMMAND, Fl_Text_Editor::kf_copy ,0}, + { 'v', FL_COMMAND, Fl_Text_Editor::kf_paste ,0}, + { 'a', FL_COMMAND, Fl_Text_Editor::kf_select_all ,0}, + { FL_Left, FL_COMMAND, Fl_Text_Editor::kf_meta_move ,0}, + { FL_Right, FL_COMMAND, Fl_Text_Editor::kf_meta_move ,0}, + { FL_Up, FL_COMMAND, Fl_Text_Editor::kf_meta_move ,0}, + { FL_Down, FL_COMMAND, Fl_Text_Editor::kf_meta_move ,0}, + { FL_Left, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move ,0}, + { FL_Right, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move ,0}, + { FL_Up, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move ,0}, + { FL_Down, FL_COMMAND|FL_SHIFT, Fl_Text_Editor::kf_m_s_move ,0}, + { 0, 0, 0 ,0} +}; + + +Fl_Cocoa_Screen_Driver::Fl_Cocoa_Screen_Driver() { + text_editor_extra_key_bindings = extra_bindings; +} + void Fl_Cocoa_Screen_Driver::init() { -- cgit v1.2.3