Removed emacs shortcuts from Fl_Input,

conformed Fl_Input keystrokes to native environment (much research went into this, citations included).
Tested editing functions on all three platforms. Doxygen docs updated.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8067 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano
2010-12-20 06:42:38 +00:00
parent 31f6505cb3
commit df6de286e7
2 changed files with 599 additions and 341 deletions
+213 -45
View File
@@ -44,57 +44,225 @@
Characters can be input using the keyboard or the character palette/map.
Character composition is done using dead keys and/or a compose
key as defined by the operating system.
</P>
<CENTER><TABLE border=1 WIDTH=90% summary="Fl_Input keyboard and mouse bindings.">
<TR><TD WIDTH=200><B>Mouse button 1</B></TD><TD>Moves the cursor to
this point. Drag selects characters. Double click selects words.
Triple click selects all text. Shift+click extends the selection.
When you select text it is automatically copied to the clipboard.
</TD></TR>
<TR><TD><B>Mouse button 2</B></TD><TD>Insert the clipboard at
the point clicked. You can also select a region and replace it with the
clipboard by selecting the region with mouse button 2.
</TD></TR>
<TR><TD><B>Mouse button 3</B></TD><TD>Currently acts like button 1.</TD></TR>
<TR><TD><B>Backspace</B></TD><TD>Deletes one character to the left, or
deletes the selected region.</TD></TR>
<TR><TD><B>Enter</B></TD><TD>May cause the callback, see when().</TD></TR>
<TR><TD><B>^A or Home</B></TD><TD>Go to start of line.</TD></TR>
<TR><TD><B>^B or Left</B></TD><TD>Move left</TD></TR>
<TR><TD><B>^C</B></TD><TD>Copy the selection to the clipboard</TD></TR>
<TR><TD><B>^D or Delete</B></TD><TD>Deletes one character to the right
or deletes the selected region.</TD></TR>
<TR><TD><B>^E or End</B></TD><TD>Go to the end of line.</TD></TR>
<TR><TD><B>^F or Right</B></TD><TD>Move right</TD></TR>
<TR><TD><B>^K</B></TD><TD>Delete to the end of line (next \\n character)
or deletes a single \\n character. These deletions are all concatenated
into the clipboard.</TD></TR>
<TR><TD><B>^N or Down</B></TD><TD>Move down (for Fl_Multiline_Input
only, otherwise it moves to the next input field).</TD></TR>
<TR><TD><B>^P or Up</B></TD><TD>Move up (for Fl_Multiline_Input only,
otherwise it moves to the previous input field).</TD></TR>
<TR><TD><B>^U</B></TD><TD>Delete everything.</TD></TR>
<TR><TD><B>^V or ^Y</B></TD><TD>Paste the clipboard</TD></TR>
<TR><TD><B>^X or ^W</B></TD><TD>Copy the region to the clipboard and
delete it.</TD></TR>
<TR><TD><B>^Z or ^_</B></TD><TD>Undo. This is a single-level undo
mechanism, but all adjacent deletions and insertions are concatenated
into a single "undo". Often this will undo a lot more than you
expected.</TD></TR>
<TR><TD><B>Shift+move</B></TD><TD>Move the cursor but also extend the
selection.</TD></TR>
</TABLE></CENTER>
<P>
<TABLE WIDTH=90% BORDER=1 SUMMARY="Fl_Input keyboard and mouse bindings.">
<CAPTION>Fl_Input keyboard and mouse bindings.</CAPTION>
<TR><TD NOWRAP="NOWRAP" WIDTH="1%">
<B>Mouse button 1</B>
</TD><TD>
Moves the cursor to this point.
Drag selects characters.
Double click selects words.
Triple click selects all text.
Shift+click extends the selection.
When you select text it is automatically copied to the clipboard.
</TD></TR><TR><TD NOWRAP="NOWRAP">
<B>Mouse button 2</B>
</TD><TD>
Insert the clipboard at the point clicked.
You can also select a region and replace it with the clipboard
by selecting the region with mouse button 2.
</TD></TR><TR><TD NOWRAP="NOWRAP">
<B>Mouse button 3</B>
</TD><TD>
Currently acts like button 1.
</TD></TR><TR><TD NOWRAP="NOWRAP">
<B>Backspace</B>
</TD><TD>
Deletes one character to the left, or deletes the selected region.
</TD></TR><TR><TD NOWRAP="NOWRAP">
<B>Delete</B>
</TD><TD>
Deletes one character to the right, or deletes the selected region.
Combine with Shift for equivalent of ^X (copy+cut).
</TD></TR><TR><TD NOWRAP="NOWRAP">
<B>Enter</b>
</TD><TD>
May cause the callback, see when().
</TD></TR></TABLE>
<P>
<TABLE WIDTH="90%" BORDER="1" SUMMARY="Fl_Input platform specific keyboard bindings.">
<CAPTION>Fl_Input platform specific keyboard bindings.</CAPTION>
<TR>
<TD NOWRAP="NOWRAP" WIDTH="1%"><B> Windows/Linux </B></TD>
<TD NOWRAP="NOWRAP" WIDTH="1%"><B> Mac </B></TD>
<TD NOWRAP="NOWRAP" ><B> Function </B></TD>
</TR><TR>
<TD NOWRAP="NOWRAP"><B> ^A </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-A </B></TD>
<TD>
<B>Selects all text in the widget.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^C </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-C </B></TD>
<TD>
<B>Copy the current selection to the clipboard.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^I </B></TD>
<TD NOWRAP="NOWRAP"><B> ^I </B></TD>
<TD>
<B>Insert a tab.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^J </B></TD>
<TD NOWRAP="NOWRAP"><B> ^J </B></TD>
<TD>
<B>Insert a Line Feed.</B> <BR>
(Similar to literal 'Enter' character)
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^L </B></TD>
<TD NOWRAP="NOWRAP"><B> ^L </B></TD>
<TD>
<B>Insert a Form Feed.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^M </B></TD>
<TD NOWRAP="NOWRAP"><B> ^M </B></TD>
<TD>
<B>Insert a Carriage Return.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^V,<BR>Shift-Insert </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-V </B></TD>
<TD>
<B>Paste the clipboard.</B> <BR>
(Macs keyboards don't have "Insert" keys,
but if they did, Shift-Insert would work)
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^X,<BR>Shift-Delete </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-X,<BR>Shift-Delete </B></TD>
<TD>
<B>Cut.</B> <BR>
Copy the selection to the clipboard and delete it.
(If there's no selection, Shift-Delete acts like Delete)
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> ^Z </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-Z </B></TD>
<TD>
<B>Undo.</B> <BR>
This is a single-level undo mechanism, but all adjacent
deletions and insertions are concatenated into a single "undo".
Often this will undo a lot more than you expected.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Shift-^Z </B></TD>
<TD NOWRAP="NOWRAP"><B> Shift-Command-Z </B></TD>
<TD>
<B>Redo.</B> <BR>
Currently same behavior as ^Z.
Reserved for future multilevel undo/redo.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD>
<TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD>
<TD>
<B>Standard cursor movement.</B> <BR>
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Home </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-Up,<BR>Command-Left </B></TD>
<TD>
<B>Move to start of line.</B> <BR>
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> End </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-Down,<BR>Command-Right </B></TD>
<TD>
<B>Move to end of line.</B> <BR>
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B>Ctrl-Home</B></TD>
<TD NOWRAP="NOWRAP"><B>Command-Up,<BR>Command-PgUp,<BR>Ctrl-Left</B></TD>
<TD>
<B>Move to top of document/field.</B> <BR>
In single line input, moves to start of line.
In multiline input, moves to start of top line.
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Ctrl-End </B></TD>
<TD NOWRAP="NOWRAP"><B> Command-End,<BR>Command-PgDn,<BR>Ctrl-Right</B></TD>
<TD>
<B>Move to bottom of document/field.</B> <BR>
In single line input, moves to end of line.
In multiline input, moves to end of last line.
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Ctrl-Left </B></TD>
<TD NOWRAP="NOWRAP"><B> Alt-Left </B></TD>
<TD>
<B>Word left.</B> <BR>
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Ctrl-Right </B></TD>
<TD NOWRAP="NOWRAP"><B> Alt-Right </B></TD>
<TD>
<B>Word right.</B> <BR>
Can be combined with Shift to extend selection.
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Ctrl-Backspace </B></TD>
<TD NOWRAP="NOWRAP"><B> Alt-Delete, Alt-Backspace </B></TD>
<TD>
<B>Delete word left.</B>
</TD></TR><TR>
<TD NOWRAP="NOWRAP"><B> Ctrl-Delete </B></TD>
<TD NOWRAP="NOWRAP"><B> Alt-Delete </B></TD>
<TD>
<B>Delete word right.</B>
</TD></TR></TABLE>
*/
class FL_EXPORT Fl_Input : public Fl_Input_ {
int handle_key();
int shift_position(int p);
int shift_up_down_position(int p);
void handle_mouse(int keepmark=0);
// Private keyboard functions
int kf_lines_up(int repeat_num);
int kf_lines_down(int repeat_num);
int kf_page_up();
int kf_page_down();
int kf_insert_toggle();
int kf_delete_word_right();
int kf_delete_word_left();
int kf_delete_sol();
int kf_delete_eol();
int kf_delete_char_right();
int kf_delete_char_left();
int kf_move_sol();
int kf_move_eol();
int kf_clear_eol();
int kf_move_char_left();
int kf_move_char_right();
int kf_move_word_left();
int kf_move_word_right();
int kf_move_up_and_sol();
int kf_move_down_and_eol();
int kf_top();
int kf_bottom();
int kf_select_all();
int kf_undo();
int kf_redo();
int kf_copy();
int kf_paste();
int kf_copy_cut();
protected:
void draw();
public:
+386 -296
View File
File diff suppressed because it is too large Load Diff