本文整理汇总了C++中FramePtr::delete_line方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::delete_line方法的具体用法?C++ FramePtr::delete_line怎么用?C++ FramePtr::delete_line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::delete_line方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjust_lines
ERRORCODE TextFlow::adjust_lines(DB_RECORD_NUMBER f_record, WORD_DELTA wdelta)
{
FramePtr frame;
L_INDEX l_index;
LINE_PTR lp;
PCOORD new_top;
ERRORCODE error;
/* Make sure we avoid busy work. */
if (wdelta.count == 0)
{
return ERRORCODE_None;
}
/* Lock the frame so we can access it. */
if ((frame = (FramePtr)database->get_record(f_record, &error, RECORD_TYPE_Frame)) == NULL)
{
return error;
}
/*
// Run through the line array and update all lines which need it.
// We must be careful using a pointer into the line array data since any
// deletions can cause the array data to change locations.
*/
new_top = -1;
for (lp = (LINE_PTR)frame->line.get_element(0), l_index = 0;
l_index < frame->line.count();
l_index++, lp++)
{
W_INDEX this_start = lp->w_start,
this_end = lp->w_end;
if (this_start >= wdelta.w_start)
{
if ((this_start += wdelta.count) < wdelta.w_start)
{
this_start = wdelta.w_start;
/* See if the previous line disappeared. */
if (l_index > 0)
{
LINE_PTR lprev = lp-1;
if (lprev->w_start == wdelta.w_start)
{
/* This line no longer exists. Delete it. */
new_top = lprev->baseline - lprev->ascend;
add_line_refresh_extent(frame, lprev);
frame->delete_line(--l_index);
/* Recompute 'lp' in case 'line.data' changed. */
lp = (LINE_PTR)frame->line.get_element(l_index);
}
else if (lprev->w_end == wdelta.w_start)
{
lprev->w_end--;
}
}
}
}
if (this_end >= wdelta.w_start)
{
if ((this_end += wdelta.count) < wdelta.w_start)
{
this_end = wdelta.w_start;
}
}
#ifdef DEBUG_AL
printf("Bumped LINE %d to index %d, %d\n", l_index, this_start, this_end);
#endif
/* Set the new start and end. */
lp->w_start = this_start;
lp->w_end = this_end;
/* Lines are moving! */
if (new_top != -1)
{
add_line_refresh_extent(frame, lp);
lp->baseline = new_top + lp->line_spacing - lp->descend;
new_top = lp->baseline + lp->descend;
add_line_refresh_extent(frame, lp);
}
}
frame->release(TRUE);
return ERRORCODE_None;
}
示例2: rebuild_lines
//.........这里部分代码省略.........
printf("old [%d to %d] vs. new [%d to %d]\n",
old_line.w_start, old_line.w_end,
lp->w_start, lp->w_end);
#endif
if (old_line.baseline != -1)
{
add_line_refresh_extent(frame, &old_line);
}
}
else
{
#ifdef DEBUG_RL
printf("Line %d stayed the same\n", l_index);
#endif
/* We can end now! */
if (w_index > wrange.w_end)
{
break;
}
}
/* See if we're done. */
if (w_index >= word_count)
{
/* Run out of words. Finished. */
break;
}
/*
// Move to a new line.
// Add one if there are no more left.
*/
line_top = baseline + lp->descend;
if (++l_index == frame->number_of_lines())
{
/* Create a new dummy line. */
LINE line;
#ifdef DEBUG_RL
printf("(Create a new line)\n");
#endif
line.w_start = line.w_end = 0; /* In case. */
line.baseline = -1;
frame->insert_line(l_index, &line);
lp = frame->get_line(l_index);
}
else
{
/* Add a refresh extent for the old line in case it's changing. */
#ifdef DEBUG_RL
printf("(Move onto existing line)\n");
#endif
lp++;
}
}
#ifdef DEBUG_RL
printf("Done (final l_index:%d, w_index:%d)...\n", l_index, w_index);
#endif
/* If we flowed all words, delete any trailing lines. */
if (w_index == word_count)
{
if (++l_index < frame->number_of_lines())
{
while (l_index < frame->number_of_lines())
{
#ifdef DEBUG_RL
printf("{Delete line}");
#endif
add_line_refresh_extent(frame, frame->get_line(l_index));
frame->delete_line(l_index);
}
#ifdef DEBUG_RL
printf("\n");
#endif
}
}
if (frame_flags & FRAME_FLAG_ystretch_frame)
{
position_lines(frame, style.get_vertical_alignment());
object->ystretch_frame();
}
position_lines(frame, style.get_vertical_alignment());
/*
// Release our objects.
*/
paragraph->release(TRUE);
frame->release(TRUE);
return ERRORCODE_None;
}