本文整理汇总了C++中FramePtr::get_bound方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::get_bound方法的具体用法?C++ FramePtr::get_bound怎么用?C++ FramePtr::get_bound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::get_bound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: position_lines
VOID TextFlow::position_lines(FramePtr frame, VERT_ALIGN_TYPE align_type)
{
PCOORD y_offset;
L_INDEX l_index;
LINE_PTR lp;
PBOX refresh_offsets;
PBOX bound = frame->get_bound();
PCOORD baseline;
/*
// Compute the height of all the lines so we can know how to align them.
*/
y_offset = 0;
baseline = 0;
SHORT line_count = frame->number_of_lines();
if (line_count == 0)
{
refresh_offsets.x0 = 0;
refresh_offsets.x1 = 0;
}
else
{
PCOORD xmin, xmax;
xmin = 0x7fffffff;
xmax = -xmin;
for (lp = frame->get_line(0), l_index = 0; l_index < line_count; lp++, l_index++)
{
xmin = __min(xmin, lp->refresh_xmin);
xmax = __max(xmax, lp->refresh_xmax);
if (l_index == 0)
{
baseline = y_offset + lp->ascend;
}
else
{
baseline = y_offset + lp->line_spacing - lp->descend;
}
y_offset = baseline + lp->descend;
}
refresh_offsets.x0 = xmin;
refresh_offsets.x1 = xmax;
}
/*
// Compute the offset value from the height of the text and the frame height.
*/
if ((y_offset = bound.y1 - bound.y0 - y_offset) > 0)
{
switch (align_type)
{
case ALIGN_top:
{
y_offset = 0;
break;
}
case ALIGN_middle:
{
y_offset /= 2;
break;
}
case ALIGN_bottom:
default:
{
break;
}
}
}
else
{
/* Text too big for frame. Top align it. */
y_offset = 0;
}
refresh_offsets.y0 = y_offset;
/*
// We have the amount to offset. Do the offset now.
*/
for (lp = frame->get_line(0), l_index = 0; l_index < line_count; lp++, l_index++)
{
if (l_index == 0)
{
y_offset += lp->ascend;
}
else
{
y_offset += lp->line_spacing - lp->descend;
}
if (y_offset != lp->baseline)
{
if (lp->baseline != -1)
{
//.........这里部分代码省略.........
示例2: add_width_refresh_extent
VOID near TextFlow::add_width_refresh_extent(
FramePtr frame, LINE_PTR lp,
PCOORD xmin, PCOORD xmax,
REFRESH_TYPE refresh_type)
{
if (want_refresh && database->can_refresh())
{
PBOX pbox, bound = frame->get_bound();
PCOORD baseline;
FLAGS object_flags = frame_object->get_flags();
if (object_flags & OBJECT_FLAG_xflipped)
{
pbox.x0 = bound.x1 - xmax;
pbox.x1 = bound.x1 - xmin;
}
else
{
pbox.x0 = bound.x0 + xmin;
pbox.x1 = bound.x0 + xmax;
}
if (pbox.x0 >= pbox.x1)
{
/* Null box */
return;
}
#if 0
printf("WR: %c%ld %ld%c\n",
refresh_type == REFRESH_ERASE ? '(' : '[',
pbox.x0,
pbox.x1,
refresh_type == REFRESH_ERASE ? ')' : ']');
#endif
#if 0
/* Allow for pixels added by hinting and by clear-out */
pbox.x0 -= 2*redisplay_x_pixel;
pbox.x1 += 2*redisplay_x_pixel;
#endif
baseline = lp->baseline;
pbox.y0 = baseline - lp->ascend /*- 2*redisplay_y_pixel*/;
pbox.y1 = baseline + lp->descend /*+ 2*redisplay_y_pixel*/;
pbox.y0 = __max(pbox.y0, 0);
pbox.y1 = __min(pbox.y1, bound.y1-bound.y0);
if (object_flags & OBJECT_FLAG_yflipped)
{
PCOORD y0 = pbox.y0;
pbox.y0 = bound.y1 - pbox.y1;
pbox.y1 = bound.y1 - y0;
}
else
{
pbox.y0 += bound.y0;
pbox.y1 += bound.y0;
}
RECT rExtraPixels;
SetRect(&rExtraPixels, 2, 2, 2, 2);
database->do_refresh_notify(&pbox, refresh_type, frame_object, &rExtraPixels);
}
}
示例3: refresh_frame
ERRORCODE TextFlow::refresh_frame(DB_RECORD_NUMBER f_record, CHARACTER_RANGE crange)
{
ERRORCODE error;
DB_RECORD_NUMBER p_record;
WORD_RANGE wrange;
FramePtr frame;
ParagraphPtr paragraph;
LINE line;
PBOX pbox;
/* Get the frame. */
if ((frame = (FramePtr)database->get_record(f_record, &error, RECORD_TYPE_Frame)) == NULL)
{
return error;
}
p_record = frame->get_paragraph();
/* Get the paragraph of the frame. */
if ((paragraph = (ParagraphPtr)database->get_record(p_record, &error, RECORD_TYPE_Paragraph)) == NULL)
{
frame->release();
return error;
}
/* Fix the character range if special values were used. */
if (crange.c_start < 0)
{
crange.c_start = 0;
}
if (crange.c_end < 0)
{
crange.c_end = paragraph->number_of_characters();
}
/* Get the word range. */
paragraph->crange_to_wrange(crange, &wrange);
paragraph->release();
/* Get the top (and possibly bottom) line.*/
frame->line_of_word(wrange.w_start, &line);
pbox.y0 = line.baseline - line.ascend;
/* Now see if the words differ. If not, we must be on the same line. */
if (wrange.w_end != wrange.w_start)
{
/* Get the bottom line. */
frame->line_of_word(wrange.w_end, &line);
}
pbox.y1 = line.baseline + line.descend;
/* Get the frame so we can get the bound. */
PBOX bound = frame->get_bound();
FLAGS object_flags = frame_object->get_flags();
pbox.x0 = bound.x0;
pbox.x1 = bound.x1;
if (object_flags & OBJECT_FLAG_yflipped)
{
PCOORD y0 = pbox.y0;
pbox.y0 = bound.y1 - pbox.y1;
pbox.y1 = bound.y1 - y0;
}
else
{
pbox.y0 += bound.y0;
pbox.y1 += bound.y0;
}
frame->release();
/* Do the actual refresh add. */
database->do_refresh_notify(&pbox, REFRESH_ALL, NULL);
return ERRORCODE_None;
}
示例4: rebuild_lines
//.........这里部分代码省略.........
for (lp = frame->get_line(0), l_index = 0;
l_index < line_count;
l_index++, lp++)
{
/* MH 4/25/93 this was "if (lp->w_end >= wrange.w_start)" */
if (lp->w_end + 1 >= wrange.w_start)
{
break;
}
}
/*
// Adjust w_start to the start of the line or our word, whichever is first.
*/
if (wrange.w_start > lp->w_start)
{
wrange.w_start = lp->w_start;
}
#ifdef DEBUG_RL
printf("Flow words from %d to %d @ line %d\n", wrange.w_start, wrange.w_end, l_index);
#endif
/*
// Now, we have the line (l_index) and the first word to flow (w_start) into
// it. Let's do some flowin'!
*/
/* Compute the flowable extent and the size of a tab. */
TextStyleRef style = paragraph->get_style();
PBOX bound = frame->get_bound();
frame_left = style.get_left_margin();
frame_extent = bound.x1 - bound.x0
- (style.get_left_margin() + style.get_right_margin());
use_white_space = frame_flags & FRAME_FLAG_use_white_space;
if ((tab_size = frame_extent / 16) == 0)
{
tab_size = 1;
}
/* Compute the current top of line. */
baseline = lp->baseline;
line_top = baseline - lp->ascend;
#ifdef DEBUG_RL
printf("current baseline: %ld, ascend: %ld, line_top:%ld\n",
baseline, lp->ascend, line_top);
#endif
for (w_index = wrange.w_start, wp = paragraph->get_word(w_index);; )
{
PCOORD extent; /* Horizontal extent. */
PCOORD x_offset; /* Horizontal position. */
PCOORD solid_x_offset;
LINE old_line;
BOOL line_changed;
#ifdef DEBUG_RL
printf("(flow next line)\n");
#endif