mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-24 03:16:52 +03:00
Add yesno support to mouse
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@594 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
6b58acd377
commit
235ab192af
@ -1,8 +1,8 @@
|
||||
Cvs code -
|
||||
- General
|
||||
- New global variables currshortcut and currslen to support using
|
||||
the mouse with the shortcuts. FIXME - Does not support the
|
||||
do_yesno function yet as that will have to be done by hand.
|
||||
the mouse with the shortcuts. FIXME - Does not support clicking
|
||||
on filenames in the browser, yet.
|
||||
|
||||
nano 1.1 tree forked here 04/07/2001
|
||||
|
||||
|
39
winio.c
39
winio.c
@ -1044,6 +1044,12 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||
char *nostr; /* Same for no */
|
||||
char *allstr; /* And all, surprise! */
|
||||
char shortstr[5]; /* Temp string for above */
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
MEVENT mevent;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Yes, no and all are strings of any length. Each string consists of
|
||||
all characters accepted as a valid character for that value.
|
||||
@ -1091,6 +1097,39 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||
kbinput = wgetch(edit);
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
case KEY_MOUSE:
|
||||
|
||||
/* Look ma! We get to duplicate lots of code from do_mouse!! */
|
||||
if (getmouse(&mevent) == ERR)
|
||||
break;
|
||||
if (!wenclose(bottomwin, mevent.y, mevent.x) || ISSET(NO_HELP))
|
||||
break;
|
||||
mevent.y -= editwinrows + 3;
|
||||
if (mevent.y < 0)
|
||||
break;
|
||||
else {
|
||||
|
||||
/* Rather than a bunch of if statements, set up a matrix
|
||||
of possible return keystrokes based on the x and y values */
|
||||
if (all) {
|
||||
char yesnosquare[2][2] = {
|
||||
{yesstr[0], allstr[0]},
|
||||
{nostr[0], NANO_CONTROL_C }};
|
||||
|
||||
ungetch(yesnosquare[mevent.y][mevent.x/(COLS/6)]);
|
||||
} else {
|
||||
char yesnosquare[2][2] = {
|
||||
{yesstr[0], '\0'},
|
||||
{nostr[0], NANO_CONTROL_C }};
|
||||
|
||||
ungetch(yesnosquare[mevent.y][mevent.x/(COLS/6)]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case NANO_CONTROL_C:
|
||||
ok = -2;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user