/* * ttresize - recompute the screen dimensions if necessary, and then * adjust pico's internal buffers accordingly. */ void ttresize(void) { int row, col; mswin_getscreensize(&row, &col); resize_pico (row-1, col); }
/* * This function is called once to set up the terminal device streams. */ int ttopen(void) { int rows, columns; mswin_getscreensize (&rows, &columns); term.t_nrow = rows - 1; term.t_ncol = columns; /* term.t_scrsiz = (columns * 2) / 3; */ /* * Do we implement optimized character insertion and deletion? * o_insert() and o_delete() */ /* inschar = delchar = FALSE; */ /* revexist = TRUE; dead code? */ mswin_setresizecallback (mswin_resize); init_mouse(); return(1); }
/*---------------------------------------------------------------------- Initialize the screen for output, set terminal type, etc Args: tt -- Pointer to variable to store the tty output structure. Result: terminal size is discovered and set pine state termcap entry is fetched and stored in local variables make sure terminal has adequate capabilites evaluate scrolling situation returns status of indicating the state of the screen/termcap entry Returns: -1 indicating no terminal name associated with this shell, -2..-n No termcap for this terminal type known -3 Can't open termcap file -4 Terminal not powerful enough - missing clear to eoln or screen or cursor motion ----*/ int config_screen(struct ttyo **tt) { struct ttyo *ttyo; _line = 0; /* where are we right now?? */ _col = 0; /* assume zero, zero... */ mswin_getscreensize(&_lines, &_columns); if (_lines > MAX_SCREEN_ROWS) _lines = MAX_SCREEN_ROWS; if (_columns > MAX_SCREEN_COLS) _columns = MAX_SCREEN_COLS; ttyo = (struct ttyo *)fs_get(sizeof(struct ttyo)); ttyo->screen_cols = _columns; ttyo->screen_rows = _lines ; ttyo->header_rows = 2; ttyo->footer_rows = 3; *tt = ttyo; return(0); }
/*---------------------------------------------------------------------- Get the current window size Args: ttyo -- pointer to structure to store window size in NOTE: we don't override the given values unless we know better ----*/ int get_windsize(struct ttyo *ttyo) { char fontName[LF_FACESIZE+1]; char fontSize[12]; char fontStyle[64]; char fontCharSet[256]; char windowPosition[32], windowPositionReg[32]; char foreColor[64], backColor[64]; int newRows, newCols; char cursorStyle[32]; cursorStyle[0] = '\0'; /* Get the new window parameters and update the 'pinerc' variables. */ mswin_getwindow(fontName, sizeof(fontName), fontSize, sizeof(fontSize), fontStyle, sizeof(fontStyle), windowPosition, sizeof(windowPosition), foreColor, sizeof(foreColor), backColor, sizeof(backColor), cursorStyle, sizeof(cursorStyle), fontCharSet, sizeof(fontCharSet)); if(!ps_global->VAR_FONT_NAME || strucmp(ps_global->VAR_FONT_NAME, fontName)) set_variable(V_FONT_NAME, fontName, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_FONT_SIZE || strucmp(ps_global->VAR_FONT_SIZE, fontSize)) set_variable(V_FONT_SIZE, fontSize, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_FONT_STYLE || strucmp(ps_global->VAR_FONT_STYLE, fontStyle)) set_variable(V_FONT_STYLE, fontStyle, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_FONT_CHAR_SET || strucmp(ps_global->VAR_FONT_CHAR_SET, fontCharSet)) set_variable(V_FONT_CHAR_SET, fontCharSet, 1, 0, ps_global->ew_for_except_vars); if(strnicmp(windowPosition, "MIN0", 4) && !strchr(windowPosition, '!')){ if(F_ON(F_STORE_WINPOS_IN_CONFIG, ps_global)){ if(!ps_global->VAR_WINDOW_POSITION || strucmp(ps_global->VAR_WINDOW_POSITION, windowPosition)) set_variable(V_WINDOW_POSITION, windowPosition, 1, 0, ps_global->ew_for_except_vars); } else{ /* * Get the window position stored in the registry. * * If current window position is not in the registry or is * different from what is there, save it. */ if((!mswin_reg(MSWR_OP_GET, MSWR_PINE_POS, windowPositionReg, sizeof(windowPositionReg)) || strucmp(windowPositionReg, windowPosition)) && (ps_global->update_registry != UREG_NEVER_SET)) mswin_reg(MSWR_OP_SET | MSWR_OP_FORCE, MSWR_PINE_POS, windowPosition, (size_t)NULL); } } mswin_getprintfont(fontName, sizeof(fontName), fontSize, sizeof(fontSize), fontStyle, sizeof(fontStyle), fontCharSet, sizeof(fontCharSet)); if(!ps_global->VAR_PRINT_FONT_NAME || strucmp(ps_global->VAR_PRINT_FONT_NAME, fontName)) set_variable(V_PRINT_FONT_NAME, fontName, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_PRINT_FONT_SIZE || strucmp(ps_global->VAR_PRINT_FONT_SIZE, fontSize)) set_variable(V_PRINT_FONT_SIZE, fontSize, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_PRINT_FONT_STYLE || strucmp(ps_global->VAR_PRINT_FONT_STYLE, fontStyle)) set_variable(V_PRINT_FONT_STYLE, fontStyle, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_PRINT_FONT_CHAR_SET || strucmp(ps_global->VAR_PRINT_FONT_CHAR_SET, fontCharSet)) set_variable(V_PRINT_FONT_CHAR_SET, fontCharSet, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_NORM_FORE_COLOR || strucmp(ps_global->VAR_NORM_FORE_COLOR, foreColor)) set_variable(V_NORM_FORE_COLOR, foreColor, 1, 0, ps_global->ew_for_except_vars); if(!ps_global->VAR_NORM_BACK_COLOR || strucmp(ps_global->VAR_NORM_BACK_COLOR, backColor)) set_variable(V_NORM_BACK_COLOR, backColor, 1, 0, ps_global->ew_for_except_vars); if(cursorStyle[0] && !ps_global->VAR_CURSOR_STYLE || strucmp(ps_global->VAR_CURSOR_STYLE, cursorStyle)) set_variable(V_CURSOR_STYLE, cursorStyle, 1, 0, ps_global->ew_for_except_vars); /* Get new window size. Compare to old. The window may have just * moved, in which case we don't bother updating the size. */ mswin_getscreensize(&newRows, &newCols); if (newRows == ttyo->screen_rows && newCols == ttyo->screen_cols) return (NO_OP_COMMAND); /* True resize. */ ttyo->screen_rows = newRows; ttyo->screen_cols = newCols; if (ttyo->screen_rows > MAX_SCREEN_ROWS) ttyo->screen_rows = MAX_SCREEN_ROWS; if (ttyo->screen_cols > MAX_SCREEN_COLS) ttyo->screen_cols = MAX_SCREEN_COLS; return(KEY_RESIZE); }