From df60477f7ca1f39619db5904f33784fc824ce51a Mon Sep 17 00:00:00 2001 From: anon <anon@anon.anon> Date: Wed, 13 Nov 2024 12:58:12 +0100 Subject: [PATCH] remove the rest of the references to mice from global visibility --- source/command.c | 40 --------------------------------------- source/global.h | 17 +---------------- source/input.c | 15 ++++++++------- source/mouse.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 63 deletions(-) diff --git a/source/command.c b/source/command.c index 8b6c49b..c7c7879 100644 --- a/source/command.c +++ b/source/command.c @@ -59,9 +59,6 @@ bool caseless; /* ignore letter case when searching */ bool *change; /* change this line */ char newpat[PATLEN + 1]; /* new pattern */ -/* Internal prototypes: */ -static void scrollbar(MOUSE *p); - /* read references from a file */ bool readrefs(char *filename) { FILE *file; @@ -96,43 +93,6 @@ bool readrefs(char *filename) { return (true); } -/* scrollbar actions */ -static void scrollbar(MOUSE *p) { - // XXX - ///* reposition list if it makes sense */ - // if (totallines == 0) { - // return; - // } - // switch (p->percent) { - - // case 101: /* scroll down one page */ - // if (nextline + mdisprefs > totallines) { - // nextline = totallines - mdisprefs + 1; - // } - // break; - - // case 102: /* scroll up one page */ - // nextline = topline - mdisprefs; - // if (nextline < 1) { - // nextline = 1; - // } - // break; - - // case 103: /* scroll down one line */ - // nextline = topline + 1; - // break; - - // case 104: /* scroll up one line */ - // if (topline > 1) { - // nextline = topline - 1; - // } - // break; - // default: - // nextline = p->percent * totallines / 100; - // } - ////seekline(nextline); -} - /* count the references found */ void countrefs(void) { char file[PATHLEN + 1]; /* file name */ diff --git a/source/global.h b/source/global.h index 2f620a3..e954ae0 100644 --- a/source/global.h +++ b/source/global.h @@ -60,15 +60,6 @@ typedef void (*sighandler_t)(int); -typedef struct { /* mouse action */ - int button; - int percent; - int x1; - int y1; - int x2; - int y2; -} MOUSE; - struct cmd { /* command history struct */ struct cmd *prev, *next; /* list ptrs */ int field; /* input field number */ @@ -200,16 +191,11 @@ extern struct keystruct { struct keystruct *next; } keyword[]; -/* mouse.c global data */ -extern bool mouse; /* mouse interface */ - /* readline.c global data */ extern char *rl_line_buffer; extern char input_line[PATLEN + 1]; extern int rl_point; -// extern bool unixpcmouse; /* UNIX PC mouse interface */ - /* cscope functions called from more than one function or between files */ char *filepath(char *file); @@ -310,8 +296,7 @@ bool readrefs(char *filename); bool search(const char *query); bool writerefsfound(void); -int findinit(const char *pattern_); -MOUSE *getmouseaction(char leading_char); +int findinit(const char *pattern_); int egrep(char *file, FILE *output, char *format); int hash(const char * ss); diff --git a/source/input.c b/source/input.c index c4e1097..ed65ccc 100644 --- a/source/input.c +++ b/source/input.c @@ -376,8 +376,6 @@ int normal_global_input(const int c) { } int change_input(const int c) { - MOUSE *p; /* mouse data */ - switch(c) { case '*': /* invert page */ for(unsigned i = 0; i < (nextline-1); i++) { @@ -391,17 +389,19 @@ int change_input(const int c) { } window_change |= CH_RESULT; break; - case ctrl('X'): /* mouse selection */ +/* MOUSE SELECTION + case ctrl('X'): + MOUSE *p; if((p = getmouseaction(DUMMYCHAR)) == NULL) { - break; /* unknown control sequence */ + break; // unknown control sequence } - /* if the button number is a scrollbar tag */ + // if the button number is a scrollbar tag if(p->button == '0') { // scrollbar(p); break; } - /* find the selected line */ - /* NOTE: the selection is forced into range */ + // find the selected line + // NOTE: the selection is forced into range { int i; for(i = disprefs - 1; i > 0; --i) { @@ -410,6 +410,7 @@ int change_input(const int c) { change[i] = !change[i]; } break; +*/ case ctrl('D'): changestring(input_line, newpat, change, totallines); free(change); diff --git a/source/mouse.c b/source/mouse.c index 7816c5a..b5667d3 100644 --- a/source/mouse.c +++ b/source/mouse.c @@ -47,6 +47,17 @@ void mousemenu(void); void mouseinit(void); void mousereinit(void); +typedef struct { /* mouse action */ + int button; + int percent; + int x1; + int y1; + int x2; + int y2; +} MOUSE; + +MOUSE *getmouseaction(char leading_char); + // extern bool unixpcmouse; /* UNIX PC mouse interface */ extern int LINES; @@ -430,3 +441,41 @@ int process_mouse() { return false; } + +// NOTE: this comes from command.c +// /* scrollbar actions */ +// static void scrollbar(MOUSE *p) { +// // XXX +// ///* reposition list if it makes sense */ +// // if (totallines == 0) { +// // return; +// // } +// // switch (p->percent) { +// +// // case 101: /* scroll down one page */ +// // if (nextline + mdisprefs > totallines) { +// // nextline = totallines - mdisprefs + 1; +// // } +// // break; +// +// // case 102: /* scroll up one page */ +// // nextline = topline - mdisprefs; +// // if (nextline < 1) { +// // nextline = 1; +// // } +// // break; +// +// // case 103: /* scroll down one line */ +// // nextline = topline + 1; +// // break; +// +// // case 104: /* scroll up one line */ +// // if (topline > 1) { +// // nextline = topline - 1; +// // } +// // break; +// // default: +// // nextline = p->percent * totallines / 100; +// // } +// ////seekline(nextline); +// }