📄 capctrl.c
字号:
copy_glyph(&xl_st.curchar,&vchar); } hpos_rel(-(hdist(cp_pbuf[0]))); /* Send a virtual character that covers the distance just moved - this is in case strike-thru or underlining is enabled */ if (xl_st.requested_attributes & (UL | STRIKE | DOU_UL | OVERLINE )) { vchar.font_data.algorithmic_attributes = xl_st.requested_attributes; vchar.char_data.char_code = VIR_CHAR_SPACE; vchar.char_data.char_width = xl_st.curchar.ap.xval - from_ahp; if (!xl_st.justify_mode) { process_vchar(&vchar); return; } add_to_jfy_buf(&vchar); }}/***** pr_vpa() ******************************************************* * * * vpa() - Move active position to character row # Pn * * (Pn is relative to origin 1 - decrement 1 to origin to 0) * ************************************************************************/VOID pr_vpa () {#ifdef DUMP { oprintf("VPA \n"); pprint(); /* print parameter list */ }#endif /* If a parameter value of zero is passed, convert it to a one. Then decrement the effective parameter value by one to make relative to an origin of 0,0 */ if (cp_pbuf[0] == 0) { cp_pbuf[0] = 1; } cp_pbuf[0]--; vpos_abs(vdist(cp_pbuf[0])); /* If in unit mode, cancel the setting of the .fcf */ if (xl_st.pum_mode == PUM_SIZEUNIT) { xl_st.fcf = FALSE; /* Clear 'first-character-flag' */ }}/***** pr_vpr() ******************************************************* * * * vpr() - Move active position 'Pn' # of character rows in the * * positive direction from the current position * ************************************************************************/VOID pr_vpr () {#ifdef DUMP { oprintf("VPR \n"); pprint(); /* print parameter list */ }#endif /* If a parameter value of zero is passed, convert it to a one. */ if (cp_pbuf[0] == 0) { cp_pbuf[0] = 1; } vpos_rel(vdist(cp_pbuf[0])); /* If in unit mode, cancel the setting of the .fcf */ if (xl_st.pum_mode == PUM_SIZEUNIT) { xl_st.fcf = FALSE; /* Clear 'first-character-flag' */ }}/***** pr_vpb() ******************************************************* * * * vpb() - Move active position 'Pn' # of character rows in the * * negative direction from the current position * * NOTE: This routine is identical in functionality to CCU, so * * it is the responsibility of the parser to call this routine * * if either a VPB or CCU command is received. * ************************************************************************/VOID pr_vpb () {#ifdef DUMP { oprintf("VPB \n"); pprint(); /* print parameter list */ }#endif /* If a parameter value of zero is passed, convert it to a one. */ if (cp_pbuf[0] == 0) { cp_pbuf[0] = 1; } vpos_rel(-(vdist(cp_pbuf[0])));}/***** pr_ind() ******************************************************* * * * pr_ind() - The IND control character is executed the same as a * * LF control character except that the setting of the linefeed/ * * newline mode has no effect. * ************************************************************************/VOID pr_ind () {#ifdef DUMP { cp_exit_cur_mode(); oprintf("IND \n"); }#endif /* If justification is on, justify the line and empty the buffer. */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); /* ... interpret IND as CR/LF, so do the CR first */ hpos_abs(xl_st.h_fmt_bound.min); } /* is VAI valid, or did a font change invalidate it */ if (xl_st.vai_valid == FALSE) { compute_vai(); } /* Update .avp to value of new line, do <FF> if necessary */ vert_rel_w_wrap(xl_st.vai); cp_exit_cur_mode();}/***** pr_nel() ******************************************************* * * * pr_nel() - The NEL (NEXT LINE) control character changes the * * active position to line home position on the next line, * * effectively performing a CR/LF. * ************************************************************************/VOID pr_nel () {#ifdef DUMP { cp_exit_cur_mode(); oprintf("NEL \n"); }#endif /* * This routine is executed upon detection of the "NEL" (0x85) control char * and performs BOTH a carriage return and a linefeed. * */ /* is VAI valid, or did a font change invalidate it */ if (xl_st.vai_valid == FALSE) { compute_vai(); } /* * Update .avp to value of new line, do <FF> if necessary */ vert_rel_w_wrap(xl_st.vai); /* Do CR */ hpos_abs(xl_st.h_fmt_bound.min); }/***** pr_pld() ******************************************************* * * * pr_pld() - Move active position up one half line. * ************************************************************************/VOID pr_pld () { LONG avp_save, pld_incr; WORD temp;#ifdef DUMP { cp_exit_cur_mode(); oprintf("PLD \n"); }#endif cp_exit_cur_mode(); /* Ignore this PLD if the maximum PLD nesting level has been reached */ /* or if previous PLD is still in effect that exceeded bottom margin */ if (xl_st.plf <= (PLDBM + 1)) { return; } /* Save current .avp */ avp_save = xl_st.curchar.ap.yval; /* If this PLD if the first active PLD or it follows another currently-effective PLD command, add the value from subscript table to the .avp. If this PLD follows a currently-effective PLU command, add the value from superscript table to the .avp. */ /* Make sure G0 is valid */ if (xl_st.g_table[0].gset_valid == FALSE) { compute_font_for_g_set (0); } /* Find out what font is used for G0 */ temp = xl_st.g_table[0].gset_map[32].char_font; if (xl_st.plf-- <= NOPLUPLD) { pld_incr = FNT_SUBSCRIPT_HEIGHT(temp); } else { pld_incr = -FNT_SUPERSCRIPT_HEIGHT(temp); } /* Update the avp */ switch (test_against_limits(xl_st.curchar.ap.yval + pld_incr, &xl_st.v_lim_bound)) { /* If the test for exceeding the bottom margin passed, set the plf flag * and manually set the avp */ case MIN_LIM_EXC: xl_st.curchar.ap.yval = xl_st.v_lim_bound.min; break; case MAX_LIM_EXC: xl_st.plf = PLDBM; xl_st.curchar.ap.yval = avp_save + pld_incr; break; default: xl_st.curchar.ap.yval = xl_st.curchar.ap.yval + pld_incr; }}/***** pr_plu() ******************************************************* * * * pr_plu() - Move active position up one half line. * ************************************************************************/VOID pr_plu () { LONG avp_save, plu_decr; WORD temp;#ifdef DUMP { cp_exit_cur_mode(); oprintf("PLU \n"); }#endif cp_exit_cur_mode(); /* Ignore this PLU if the maximum PLU nesting level has been reached */ /* or if the previous PLU is still in effect that exceeded the top margin */ if (xl_st.plf >= (PLUTM - 1)) { return; } /* Save current .avp */ avp_save = xl_st.curchar.ap.yval; /* If this PLU is the first active PLU or it follows another currently-effective PLU command, subtract the value from superscript table from the .avp. If this PLU follows a currently-effective PLD command, subtract the value from subscript table from the .avp. */ /* Make sure G0 is valid */ if (xl_st.g_table[0].gset_valid == FALSE) { compute_font_for_g_set (0); } /* Find out what font is used for G0 */ temp = xl_st.g_table[0].gset_map[32].char_font; if (xl_st.plf++ >= NOPLUPLD) { plu_decr = -FNT_SUPERSCRIPT_HEIGHT(temp); } else { plu_decr = FNT_SUBSCRIPT_HEIGHT(temp); } /* Update the avp */ switch (test_against_limits(xl_st.curchar.ap.yval - plu_decr, &xl_st.v_lim_bound)) { /* If the test for exceeding the top margin passed, set the plf flag * and manually set the avp */ case MIN_LIM_EXC: xl_st.plf = PLUTM; xl_st.curchar.ap.yval = avp_save - plu_decr; break; case MAX_LIM_EXC: xl_st.curchar.ap.yval = xl_st.v_lim_bound.max; break; default: xl_st.curchar.ap.yval = xl_st.curchar.ap.yval - plu_decr; }}/***** pr_ri() ******************************************************** * * * pr_ri() - (REVERSE INDEX) causes the active vertical position * * to move up one line (horizontal position remains unchanged). * * unless the new avp would be above the top margin, in which * * case the RI is ignored. * ************************************************************************/VOID pr_ri () {#ifdef DUMP { cp_exit_cur_mode(); oprintf("RI \n"); }#endif cp_exit_cur_mode(); /* If justify mode is on, justify the current contents, and empty it */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); /* ... interpret RI as CR/RI - LF, so do the CR first */ hpos_abs(xl_st.h_fmt_bound.min); } /* is VAI valid, or did a font change invalidate it */ if (xl_st.vai_valid == FALSE) { compute_vai(); } /* Update .avp to value of line above (do not go above top margin) */ vpos_rel(-xl_st.vai);}/**************************************************************************** Cursor UP Utility Function***************************************************************************/VOID pr_cuu() {#ifdef DUMP { oprintf("CUU \n"); pprint(); /* print parameter list */ }#endif pr_vpb(); /* is the same as pr_vpb */ }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -