/* * If no warning messages were encountered during startup, and the popup-msgs * mode wasn't enabled, discard the informational messages that are there * already. */ void purge_msgs(void) { TRACE(("purge_msgs mode:%d, warnings:%d\n", global_g_val(GMDPOPUP_MSGS), warnings)); if ((global_g_val(GMDPOPUP_MSGS) == -TRUE) && (warnings == 0)) { BUFFER *bp = find_b_name(MESSAGES_BufName); if (valid_buffer(bp) && bp->b_nwnd == 0) { (void) zotbuf(bp); } set_global_g_val(GMDPOPUP_MSGS, FALSE); } }
DIR * opendir(char *filename) { DIR *dirp = typecalloc(DIR); long status; if (dirp == 0) return (0); zfab = cc$rms_fab; zfab.fab$l_fop = FAB$M_NAM; zfab.fab$l_nam = &znam; /* FAB => NAM block */ zfab.fab$l_dna = (global_g_val(GMDALL_VERSIONS) ? "*.*;*" : "*.*;"); zfab.fab$b_dns = strlen(zfab.fab$l_dna); zfab.fab$l_fna = filename; zfab.fab$b_fns = strlen(filename); znam = cc$rms_nam; znam.nam$b_ess = NAM$C_MAXRSS; znam.nam$l_esa = zesa; znam.nam$b_rss = NAM$C_MAXRSS; znam.nam$l_rsa = zrsa; if (sys$parse(&zfab) != RMS$_NORMAL) { (void) closedir(dirp); dirp = 0; } return (dirp); }
void popup_msgs(void) { BUFFER *savebp = curbp; WINDOW *savewp = curwp; MARK savemk; register BUFFER *bp; WINDOW *wp; if ((bp = create_msgs()) == 0) return; savemk = DOT; if (!is_empty_buf(bp)) { if ((curwp == 0) || sgarbf || global_g_val(GMDPOPUP_MSGS) == -TRUE) { return; /* CAN'T popup yet */ } if (popupbuff(bp) == FALSE) { (void) zotbuf(bp); return; } if ((wp = bp2any_wp(bp)) != NULL) { make_local_w_val(wp, WMDNUMBER); set_w_val(wp, WMDNUMBER, FALSE); } set_rdonly(bp, non_filename(), MDVIEW); curbp = savebp; curwp = savewp; if (savewp) DOT = savemk; } }
static void tcapbeep(void) { #if OPT_FLASH if (global_g_val(GMDFLASH) && vb != NULL) { putpad(vb); } else #endif ttputc(BEL); }
static void ntconio_beep(void) { #if OPT_FLASH if (global_g_val(GMDFLASH)) { flash_display(); return; } #endif MessageBeep(0xffffffff); }
void npclose(FILE *fp) { #ifdef GMDW32PIPES if (global_g_val(GMDW32PIPES)) { native_npclose(fp); return; } #endif tmp_npclose(fp); }
int inout_popen(FILE **fr, FILE **fw, char *cmd) { TRACE(("inout_popen(fr=%p, fw=%p, cmd='%s')\n", fr, fw, cmd)); ffstatus = file_is_pipe; fileeof = FALSE; append_libdir_to_path(); #ifdef GMDW32PIPES if (global_g_val(GMDW32PIPES)) return (native_inout_popen(fr, fw, cmd)); #endif return (tmp_inout_popen(fr, fw, cmd)); }
/* * when desparate to communicate an error, enable popup messages and * use mlforce(). */ static void lastditch_msg(char *msg) { #if OPT_POPUP_MSGS int save = global_g_val(GMDPOPUP_MSGS); set_global_g_val(GMDPOPUP_MSGS, TRUE); #endif mlforce(msg); #if OPT_POPUP_MSGS update(FALSE); popup_msgs(); update(FALSE); set_global_g_val(GMDPOPUP_MSGS, save); #endif }
static void tcapkclose(void) { #if OPT_XTERM if (i_am_xterm && global_g_val(GMDXTERM_MOUSE)) putpad(XTERM_DISABLE_TRACKING); #endif if (keyboard_open) { keyboard_open = FALSE; if (TE) putnpad(TE, (int)strlen(TE)); if (KE) putpad(KE); } TTflush(); }
static void tcapkopen(void) { #if OPT_XTERM if (i_am_xterm && global_g_val(GMDXTERM_MOUSE)) putpad(XTERM_ENABLE_TRACKING); #endif if (!keyboard_open) { keyboard_open = TRUE; if (TI) putnpad(TI, (int)strlen(TI)); if (KS) putpad(KS); } (void)strcpy(sres, "NORMAL"); }
/* ARGSUSED */ int pipecmd(int f, int n) { register BUFFER *bp; /* pointer to buffer to zot */ register int s; char line[NLINE]; /* command line send to shell */ /* get the command to pipe in */ hst_init('!'); s = ShellPrompt(&save_shell[!global_g_val(GMDSAMEBANGS)], line, -TRUE); hst_flush(); /* prompt ok? */ if (s != TRUE) return s; /* take care of autowrite */ if (writeall(f,n,FALSE,FALSE,TRUE) != TRUE) return FALSE; #if BEFORE if (((s = ((bp = bfind(OUTPUT_BufName, 0)) != NULL)) == TRUE) && ((s = popupbuff(bp)) == TRUE) && ((s = swbuffer(bp)) == TRUE) && ((s = readin(line, FALSE, bp, TRUE)) == TRUE)) set_rdonly(bp, line, MDVIEW); #else if ((s = ((bp = bfind(OUTPUT_BufName, 0)) != NULL)) != TRUE) return s; if ((s = popupbuff(bp)) != TRUE) return s; ch_fname(bp,line); bp->b_active = FALSE; /* force a re-read */ if ((s = swbuffer_lfl(bp,FALSE)) != TRUE) return s; set_rdonly(bp, line, MDVIEW); #endif return (s); }
int sel_yank(int reg) { REGIONSHAPE save_shape; WINDOW *save_wp; BUFFER *save_bp = curbp; int code = FALSE; TRACE((T_CALLED "sel_yank(%d)\n", reg)); if (valid_window(save_wp = push_fake_win(selbufp))) { /* * We're not guaranteed that curbp and selbufp are the same. */ save_shape = regionshape; curbp = selbufp; ukb = (short) reg; kregflag = 0; haveregion = &selregion.ar_region; regionshape = selregion.ar_shape; yankregion(); haveregion = NULL; #ifdef GMDCBRD_ECHO if (global_g_val(GMDCBRD_ECHO)) cbrdcpy_unnamed(FALSE, FALSE); #endif pop_fake_win(save_wp, save_bp); regionshape = save_shape; show_selection_position(TRUE); /* put cursor back on screen...is there a cheaper way to do this? */ (void) update(FALSE); code = TRUE; } returnCode(code); }
static void ntconio_rev(UINT attr) { /* change video state */ scflush(); cbcolor = nbcolor; cfcolor = nfcolor; rvcolor = (global_g_val(GVAL_VIDEO) & VAREV) ? 1 : 0; attr &= (VASPCOL | VACOLOR | VABOLD | VAITAL | VASEL | VAREV); TRACE2(("ntconio_rev(%04x) f=%d, b=%d\n", attr, cfcolor, cbcolor)); if (attr) { if (attr & VASPCOL) cfcolor = (VCOLORNUM(attr) & (NCOLORS - 1)); else if (attr & VACOLOR) cfcolor = ((VCOLORNUM(attr)) & (NCOLORS - 1)); if (cfcolor == ENUM_UNKNOWN) cfcolor = DFT_FCOLOR; if (cbcolor == ENUM_UNKNOWN) cbcolor = DFT_BCOLOR; if (attr == VABOLD) { cfcolor |= FOREGROUND_INTENSITY; } if (attr == VAITAL) { cbcolor |= BACKGROUND_INTENSITY; } if (attr & (VASEL | VAREV)) { /* reverse video? */ rvcolor ^= 1; } TRACE2(("...ntconio_rev(%04x) f=%d, b=%d\n", attr, cfcolor, cbcolor)); } set_current_attr(); }
/* move howmany lines starting at from to to */ static void ntconio_scroll(int from, int to, int n) { SMALL_RECT sRect; COORD dest; CHAR_INFO fill; int scroll_pause; scflush(); if (to == from) return; #if OPT_PRETTIER_SCROLL if (ABS(from - to) > 1) { ntconio_scroll(from, (from < to) ? to - 1 : to + 1, n); if (from < to) from = to - 1; else from = to + 1; } #endif #ifdef UNICODE fill.Char.UnicodeChar = ' '; #else fill.Char.AsciiChar = ' '; #endif fill.Attributes = currentAttribute; sRect.Left = 0; sRect.Top = (SHORT) from; sRect.Right = (SHORT) (csbi.dwMaximumWindowSize.X - 1); sRect.Bottom = (SHORT) (from + n - 1); dest.X = 0; dest.Y = (SHORT) to; ScrollConsoleScreenBuffer(hConsoleOutput, &sRect, NULL, dest, &fill); if ((scroll_pause = global_g_val(GVAL_SCROLLPAUSE)) > 0) { /* * If the user has cheap video HW (1 MB or less) and * there's a busy background app (say, dev studio), then * the console version of vile can exhibit serious repaint * problems when the display is rapidly scrolled. By * inserting a user-defined sleep after the scroll, the * video HW has a chance to properly paint before the * next scroll operation. */ Sleep(scroll_pause); } #if !OPT_PRETTIER_SCROLL if (ABS(from - to) > n) { DWORD cnt; COORD coordCursor; coordCursor.X = 0; if (to > from) { coordCursor.Y = (SHORT) (from + n); cnt = to - from - n; } else { coordCursor.Y = (SHORT) (to + n); cnt = from - to - n; } cnt *= csbi.dwMaximumWindowSize.X; erase_at(coordCursor, cnt); } #endif }
static int xterm_button(int c) { WINDOW *wp; int event; int button; int x; int y; int status; #if OPT_XTERM >= 3 int save_row = ttrow; int save_col = ttcol; int firstrow, lastrow; int startx, endx, mousex; int starty, endy, mousey; MARK save_dot; char temp[NSTRING]; static const char *fmt = "\033[%d;%d;%d;%d;%dT"; #endif /* OPT_XTERM >= 3 */ if (insertmode) return ABORT; if ((status = (global_g_val(GMDXTERM_MOUSE))) != 0) { beginDisplay; switch(c) { case 'M': /* button-event */ event = keystroke(); x = XtermPos() + x_origin; y = XtermPos() + y_origin; button = (event & 3) + 1; TRACE(("M-button event:%d x:%d y:%d\n", event, x, y)) if (button > 3) { endofDisplay; return TRUE; /* button up */ } wp = row2window(y-1); #if OPT_XTERM >= 3 /* Tell the xterm how to highlight the selection. * It won't do anything else until we do this. */ if (wp != 0) { firstrow = wp->w_toprow + 1; lastrow = mode_row(wp) + 1; } else { /* from message-line */ firstrow = term.t_nrow ; lastrow = term.t_nrow + 1; } if (y >= lastrow) /* don't select modeline */ y = lastrow - 1; (void)lsprintf(temp, fmt, 1, x, y, firstrow, lastrow); putpad(temp); TTflush(); #endif /* OPT_XTERM >= 3 */ /* Set the dot-location if button 1 was pressed in a * window. */ if (wp != 0 && button == 1 && !reading_msg_line && setcursor(y-1, x-1)) { /*mlerase();*/ (void)update(TRUE); status = TRUE; } else if (button <= 3) { #if OPT_XTERM >= 3 /* abort the selection */ (void)lsprintf(temp, fmt, 0, x, y, firstrow, lastrow); putpad(temp); TTflush(); #endif /* OPT_XTERM >= 3 */ status = ABORT; } else { status = FALSE; } break; #if OPT_XTERM >= 3 case 't': /* reports valid text-location */ x = XtermPos(); y = XtermPos(); TRACE(("t: x:%d y:%d\n", x, y)) setwmark(y-1, x-1); yankregion(); movecursor(save_row, save_col); /*mlerase();*/ (void)update(TRUE); break; case 'T': /* reports invalid text-location */ /* * The starting-location returned is not the location * at which the mouse was pressed. Instead, it is the * top-most location of the selection. In turn, the * ending-location is the bottom-most location of the * selection. The mouse-up location is not necessarily * a pointer to valid text. * * This case handles multi-clicking events as well as * selections whose start or end location was not * pointing to text. */ save_dot = DOT; startx = XtermPos(); /* starting-location */ starty = XtermPos(); endx = XtermPos(); /* ending-location */ endy = XtermPos(); mousex = XtermPos(); /* location at mouse-up */ mousey = XtermPos(); TRACE(("T: start(%d,%d) end(%d,%d) mouse(%d,%d)\n", starty, startx, endy, endx, mousey, mousex)) setcursor(starty - 1, startx - 1); setwmark (endy - 1, endx - 1); if (MK.o != 0 && !is_at_end_of_line(MK)) MK.o += 1; yankregion(); DOT = save_dot; movecursor(save_row, save_col); /*mlerase();*/ (void)update(TRUE); break; #endif /* OPT_XTERM >= 3 */ default: status = FALSE; } endofDisplay; }