diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2004-11-08 17:10:34 +0000 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2004-11-08 17:10:34 +0000 |
commit | dd205b01f0eb3d82c0fd7cdbbae41a8441d4fe5e (patch) | |
tree | 51187f4faa738993deebf0653fd145f08478ebb6 /src/PSEditor.cxx | |
parent | 5334e884380e6c1c79704f9403ab98b2f6fefd7f (diff) |
add tab key and arrow key support
add tab key and arrow key support
Diffstat (limited to 'src/PSEditor.cxx')
-rw-r--r-- | src/PSEditor.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/PSEditor.cxx b/src/PSEditor.cxx index 92eea4b..efd9b97 100644 --- a/src/PSEditor.cxx +++ b/src/PSEditor.cxx @@ -1,5 +1,5 @@ // -// "$Id: PSEditor.cxx,v 1.19 2004/10/26 18:37:56 hofmann Exp $" +// "$Id: PSEditor.cxx,v 1.20 2004/11/08 18:10:34 hofmann Exp $" // // PSEditor routines. // @@ -52,7 +52,6 @@ int PSEditor::handle(int event) { if (!set_cur_text(mark_x, mark_y) == 0) { new_text(mark_x, mark_y, ""); - mod++; } Fl::focus(this); @@ -75,7 +74,6 @@ int PSEditor::handle(int event) { x_last = Fl::event_x()-x(); y_last = Fl::event_y()-y(); - mod++; return 1; break; case FL_KEYBOARD: @@ -84,15 +82,42 @@ int PSEditor::handle(int event) { int key = Fl::event_key(); if (key == FL_BackSpace) { rm_char(); - mod++; + } else if (key == FL_Left) { + PSEditText *t = model->get_cur_text(); + if (t) { + int x = t->get_x(); + int y = t->get_y(); + move(x - 1, y, x, y); + } + } else if (key == FL_Right) { + PSEditText *t = model->get_cur_text(); + if (t) { + int x = t->get_x(); + int y = t->get_y(); + move(x + 1, y, x, y); + } + } else if (key == FL_Up) { + PSEditText *t = model->get_cur_text(); + if (t) { + int x = t->get_x(); + int y = t->get_y(); + move(x, y - 1, x, y); + } + } else if (key == FL_Down) { + PSEditText *t = model->get_cur_text(); + if (t) { + int x = t->get_x(); + int y = t->get_y(); + move(x, y + 1, x, y); + } + } else if (key == FL_Tab) { + next_text(); } else if (Fl::compose(del)) { if (del > 0) { for (int i=0; i<del; i++) rm_char(); - mod++; } if (Fl::event_length()) { append_text(Fl::event_text()); - mod++; } } else { return 0; |