📄 capctrl.c
字号:
break; case MAX_LIM_EXC: /* If new avp exceeds bottom margin, wrap to next page and set fcf */ process_showpage(); /* Yes, purge current page */ update_avp(xl_st.v_fmt_bound.min, &xl_st.v_lim_bound); xl_st.fcf = TRUE; }}/***** update_ahp() *************************************************** * * * update_ahp(hpos,phlim) - Update active horizontal position. * * Update xl_st.limit_flag with the result of 'test_against_ * * limits()', and if a limit was exceeded, set xl_st.curchar.ahp * * to that limit. Otherwise, set xl_st.curchar.ahp to 'hpos'. * ************************************************************************/VOID update_ahp(hpos,phlim)LONG hpos;BOUND *phlim;{ switch (xl_st.limit_flag = test_against_limits(hpos, phlim)) { case MIN_LIM_EXC: xl_st.curchar.ap.xval = phlim->min; break; case MAX_LIM_EXC: xl_st.curchar.ap.xval = phlim->max; xl_st.rmf = TRUE; /* Set 'right margin flag' */ break; default: xl_st.curchar.ap.xval = hpos; }}/***** update_avp() *************************************************** * * * update_avp(vpos,pvlim) - Update active vertical position. * * Update xl_st.limit_flag with the result of 'test_against_ * * limits()', and if a limit was exceeded, set xl_st.curchar.avp * * to that limit. Otherwise, set xl_st.curchar.avp to 'vpos'. * ************************************************************************/VOID update_avp(vpos,pvlim)LONG vpos;BOUND *pvlim;{ xl_st.plf = NOPLUPLD; /* Indicate neither PLU nor PLD */ switch (xl_st.limit_flag = test_against_limits(vpos, pvlim)) { case MIN_LIM_EXC: xl_st.curchar.ap.yval = pvlim->min; break; case MAX_LIM_EXC: xl_st.curchar.ap.yval = pvlim->max; break; default: xl_st.curchar.ap.yval = vpos; } xl_st.curchar.attr_data.attr_baseline_offset = xl_st.curchar.ap.yval;}/***** vpos_rel_w_wrap() ********************************************** * * * vpos_rel_w_wrap(vrwpos) - Vertical position, relative mode. * * 'Vrpos' is the offset ot add to the current avp and * * wrap to a new page if end of page is hit. * * * ************************************************************************/VOID vpos_rel_w_wrap(vrwpos)LONG vrwpos;{ /* Update the current avp */ update_avp(xl_st.curchar.ap.yval + vrwpos, &xl_st.v_fmt_bound); switch (xl_st.limit_flag) { case MIN_LIM_EXC: /* If new avp exceeds page home line, set = page home line and set the first character flag */ update_avp(xl_st.v_fmt_bound.min, &xl_st.v_lim_bound); xl_st.fcf = TRUE; break; case MAX_LIM_EXC: /* If new avp exceeds page end line, wrap to next page and set fcf */ process_showpage(); /* Yes, purge current page */ update_avp(xl_st.v_fmt_bound.min, &xl_st.v_lim_bound); xl_st.fcf = TRUE; }}/***** vert_rel_w_wrap() ********************************************** * * * vert_rel_w_wrap(vrwpos) - Do a vertical relative move, and * * wrap to a new page if end of page is hit. * ************************************************************************/VOID vert_rel_w_wrap(vrwpos)LONG vrwpos;{ /* If justify mode is on, justify the current contents, and empty it */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); } vpos_rel_w_wrap(vrwpos);}/***** pr_cond_ff() ************************************************** * * * pr_cond_ff() - Effect a form feed if something on the page * ************************************************************************/VOID pr_cond_ff () { /* If justify mode is on, justify the current contents, and empty it */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); } process_condshowpg(); /* purge current page */ update_avp(xl_st.v_fmt_bound.min, &xl_st.v_lim_bound); xl_st.fcf = TRUE;}/***** pr_lf() ******************************************************** * * * pr_lf() - Effect a line feed. * ************************************************************************/VOID pr_lf (){#ifdef DUMP { oprintf("LF \n"); }#endif /* If justification is on, justify the line and empty the buffer. */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); /* ... interpret LF 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); /* If "newline mode" is set ... */ if (xl_st.lfnl_mode != 0) { /* ... interpret LF as CR/LF, so do the CR first */ hpos_abs(xl_st.h_fmt_bound.min); }}/***** pr_ff() ******************************************************** * * * pr_ff() - Effect a form feed. * ************************************************************************/VOID pr_ff () {#ifdef DUMP { oprintf("FF \n"); }#endif /* Empty any contents of the justify buffer first */ empty_jfy_buf(); /* Update .avp to value of new line, do <FF> if necessary */ vert_rel_w_wrap(PAGE_INFINITY);}/***** pr_cr() ******************************************************** * * * pr_cr() - Effect a carriage return. * ************************************************************************/VOID pr_cr () {#ifdef DUMP { oprintf("CR \n"); }#endif /* If CR-newline mode is not enabled, this is really the equivalent to a HPA(0), so empty the justify buffer and position absolutely the active postion to the left format bound. */ if (xl_st.justify_mode) { justify_buffer(); empty_jfy_buf(); } hpos_abs(xl_st.h_fmt_bound.min); /* Go to start of line */ if (xl_st.crnl_mode) { /* is VAI valid, or did a font change invalidate it */ if (xl_st.vai_valid == FALSE) { compute_vai(); } /* Then, go to a new line and reset the PLU/PLD flag */ vert_rel_w_wrap(xl_st.vai); /* Go to new line */ }}/***** pr_bs() ******************************************************** * * * pr_bs() - Effect a backspace. * ************************************************************************/VOID pr_bs () {#ifdef DUMP { oprintf("BS \n"); }#endif /* If the 'right margin flag' is already set, DO NOT move the current * location ! */ if (!(xl_st.rmf)) { hpos_rel(-(get_width((WORD)SP_C, xl_st.curchar.char_data.char_font))); } }/***** pr_hpa() ******************************************************* * * * hpa() - Move active position to character column # Pn * * (Pn is relative to origin 1 - decrement 1 to origin to 0) * ************************************************************************/VOID pr_hpa () { LONG from_ahp; GLYPH vchar;#ifdef DUMP { oprintf("HPA \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]--; from_ahp = xl_st.curchar.ap.xval; /* Save current ahp */ if (xl_st.requested_attributes & (UL | STRIKE | DOU_UL | OVERLINE )) copy_glyph(&xl_st.curchar,&vchar); hpos_abs(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; process_vchar(&vchar); }}/***** pr_hpr() ******************************************************* * * * hpr() - Move active position 'Pn' # of character columns in the * * positive direction from the current position * ************************************************************************/VOID pr_hpr () { LONG from_ahp; GLYPH vchar;#ifdef DUMP { oprintf("HPR \n"); pprint(); /* print parameter list */ }#endif /* If the 'right margin flag' is already set, DO NOT move the current location ! */ if (xl_st.rmf) { return; } /* If a parameter value of zero is passed, convert it to a one. */ if (cp_pbuf[0] == 0) cp_pbuf[0] = 1; from_ahp = xl_st.curchar.ap.xval; /* Save current ahp */ if (xl_st.requested_attributes & (UL | STRIKE | DOU_UL | OVERLINE )) 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_hpb() ******************************************************* * * * hpb() - Move active position 'Pn' # of character columns in the * * negative direction from the current position * ************************************************************************/VOID pr_hpb () { LONG from_ahp; GLYPH vchar;#ifdef DUMP { oprintf("HPB \n"); pprint(); /* print parameter list */ }#endif /* If the 'right margin flag' is already set, DO NOT move the current location ! */ if (xl_st.rmf) { return; } /* If a parameter value of zero is passed, convert it to a one. */ if (cp_pbuf[0] == 0) { cp_pbuf[0] = 1; } from_ahp = xl_st.curchar.ap.xval; /* Save current ahp */ if (xl_st.requested_attributes & (UL | STRIKE | DOU_UL | OVERLINE )) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -