CUA function keys, code submitted by George Yohng <yohng@drivex.dosware.8m.com>

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1314 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2000-10-17 07:23:42 +00:00
parent b56f14d91c
commit 65cbea2af3
3 changed files with 91 additions and 36 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Input.cxx,v 1.10.2.12 2000/06/20 07:56:08 bill Exp $"
// "$Id: Fl_Input.cxx,v 1.10.2.13 2000/10/17 07:23:42 spitzak Exp $"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
@ -62,6 +62,8 @@ int Fl_Input::handle_key() {
char ascii = Fl::event_text()[0];
int repeat_num=1;
int del;
if (Fl::compose(del)) {
@ -85,20 +87,42 @@ int Fl_Input::handle_key() {
}
switch (Fl::event_key()) {
case FL_Insert:
if (Fl::event_state() & FL_CTRL) ascii = ctrl('C');
else if (Fl::event_state() & FL_SHIFT) ascii = ctrl('V');
break;
case FL_Delete:
if (Fl::event_state() & FL_SHIFT) ascii = ctrl('X');
else ascii = ctrl('D');
break;
case FL_Left:
ascii = ctrl('B'); break;
case FL_Right:
ascii = ctrl('F'); break;
case FL_Page_Up:
repeat_num=5; //temporary hack
//TODO: find number of lines in window and use it instead 5
case FL_Up:
ascii = ctrl('P'); break;
case FL_Page_Down:
repeat_num=5; //temporary hack
//TODO: find number of lines in window and use it instead 5
case FL_Down:
ascii = ctrl('N'); break;
case FL_Delete:
ascii = ctrl('D'); break;
case FL_Home:
ascii = ctrl('A'); break;
if (Fl::event_state() & FL_CTRL) {
shift_position(0);
return 1;
}
ascii = ctrl('A');
break;
case FL_End:
if (Fl::event_state() & FL_CTRL) {
shift_position(size());
return 1;
}
ascii = ctrl('E'); break;
case FL_BackSpace:
ascii = ctrl('H'); break;
case FL_Enter:
@ -143,14 +167,22 @@ int Fl_Input::handle_key() {
cut(position(), i);
return copy_cuts();
case ctrl('N'):
i = line_end(position());
i = position();
while (repeat_num--) {
i = line_end(i);
if (i >= size()) return NORMAL_INPUT_MOVE;
shift_up_down_position(i+1);
i++;
}
shift_up_down_position(i);
return 1;
case ctrl('P'):
i = line_start(position());
i = position();
while(repeat_num--) {
i = line_start(i);
if (!i) return NORMAL_INPUT_MOVE;
shift_up_down_position(line_start(i-1));
i--;
}
shift_up_down_position(line_start(i));
return 1;
case ctrl('U'):
return cut(0, size());
@ -244,5 +276,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l)
}
//
// End of "$Id: Fl_Input.cxx,v 1.10.2.12 2000/06/20 07:56:08 bill Exp $".
// End of "$Id: Fl_Input.cxx,v 1.10.2.13 2000/10/17 07:23:42 spitzak Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: cmap.cxx,v 1.4.2.3 2000/06/05 21:21:03 mike Exp $"
// "$Id: cmap.cxx,v 1.4.2.4 2000/10/17 07:23:42 spitzak Exp $"
//
// Colormap generation program for the Fast Light Tool Kit (FLTK).
//
@ -20,7 +20,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
// Please report all bugs and problems to "fltk-bugs@easysw.com".
//
// This program produces the contents of "fl_cmap.h" as stdout
@ -51,7 +51,7 @@ static short cmap[256][3] = {
{III, 0,III}, // magenta
{ 0,III,III}, // cyan
{III,III,III}, // white
// pastel versions of those colors:
// pastel versions of those colors, from SGI's standard color map:
{ 85, 85, 85}, // 1/3 gray
{198,113,113}, // salmon? pale red?
{113,198,113}, // pale green
@ -59,10 +59,14 @@ static short cmap[256][3] = {
{113,113,198}, // pale blue
{142, 56,142}, // purple, orchid, pale magenta
{ 56,142,142}, // cadet blue, aquamarine, pale cyan
{170,170,170}, // 2/3 gray
// These next 16 are the FL_FREE_COLOR area. For compatability with
// some existing DD programs, I prefill them with the random colors
// you get on a 5.3 machine:
{170,170,170}, // 2/3 gray (FL_SELECTION_COLOR location)
// These next 16 are the FL_FREE_COLOR area. In some versions of fltk
// these were filled with random colors that a Irix 5.3 machine placed
// in these locations. Other versions of fltk filled this with the 1/3
// gray above to discourage their use. This newest version uses colors
// that NewTek has assigned for their GUI:
#if 0
// The Irix 5.3 colors:
{ 16, 16, 16},
{128, 40,128},
{198, 30, 30},
@ -79,6 +83,25 @@ static short cmap[256][3] = {
{ 80, 80, 10},
{150,150, 20},
{160, 10, 10},
#else
// The NewTek colors: (from George Yohng)
{168,168,152},
{232,232,216},
{104,104, 88},
{152,168,168},
{216,232,232},
{ 88,104,104},
{156,156,168},
{220,220,232},
{ 92, 92,104},
{156,168,156},
{220,232,220},
{ 92,104, 92},
{144,144,144},
{192,192,192},
{ 80, 80, 80},
{160,160,160},
#endif
// The rest of the colormap is a gray ramp and table, filled in below:
};
@ -119,7 +142,7 @@ int main() {
#endif
// overwrite the X allocation area with one color so people are
// discouraged from using it:
for (i=16; i<32; i++) {cmap[i][0]=cmap[i][1]=cmap[i][2] = 85;}
//for (i=16; i<32; i++) {cmap[i][0]=cmap[i][1]=cmap[i][2] = 85;}
// fill in the gray ramp:
background(0xc0, 0xc0, 0xc0); // microsoft colors
@ -148,5 +171,5 @@ int main() {
}
//
// End of "$Id: cmap.cxx,v 1.4.2.3 2000/06/05 21:21:03 mike Exp $".
// End of "$Id: cmap.cxx,v 1.4.2.4 2000/10/17 07:23:42 spitzak Exp $".
//

View File

@ -14,22 +14,22 @@
0x8e388e00,
0x388e8e00,
0xaaaaaa00,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0x55555500,
0xa8a89800,
0xe8e8d800,
0x68685800,
0x98a8a800,
0xd8e8e800,
0x58686800,
0x9c9ca800,
0xdcdce800,
0x5c5c6800,
0x9ca89c00,
0xdce8dc00,
0x5c685c00,
0x90909000,
0xc0c0c000,
0x50505000,
0xa0a0a000,
0x00000000,
0x0d0d0d00,
0x1a1a1a00,