当前位置: 首页>>代码示例>>C++>>正文


C++ FramePtr::get_line方法代码示例

本文整理汇总了C++中FramePtr::get_line方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::get_line方法的具体用法?C++ FramePtr::get_line怎么用?C++ FramePtr::get_line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FramePtr的用法示例。


在下文中一共展示了FramePtr::get_line方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rebuild_words


//.........这里部分代码省略.........
	if ((c_index = paragraph->get_word(w_end+1)->c_start-1) > crange.c_end)
	{
	/* Move forward to end of word. */
		crange.c_end = c_index;
	}

#ifdef DEBUG_RW
	printf("End offset moves to %d\n", crange.c_end);
#endif

/*
// Delete the existing range if we have one.
// Perhaps this should be optimized someday to do all at once!
*/
	if (w_end >= w_start)
	{
		/* Redisplay variables */
		BOOL new_line = TRUE;
		L_INDEX l_index;
		LINE_PTR lp;
		TEXT_WORD_PTR wp0;
		PCOORD erase_xmin, erase_xmax;

		if ((frame = (FramePtr)database->get_record(f_record, &error, RECORD_TYPE_Frame)) == NULL)
		{
			paragraph->release();
			return error;
		}

		/* Get line pointer for redisplay purposes */

		l_index = frame->line_of_word(w_end, NULL);

		lp = frame->get_line(l_index);

		erase_xmin = 0x7fffffff;
		erase_xmax = -erase_xmin;

		wdelta->count = -(w_end - w_start + 1);
		while (w_end >= w_start)
		{
#ifdef DEBUG_RW
			printf("Delete word %d\n", w_end);
#endif
			wp0 = paragraph->get_word(w_end);
			if (!new_line && w_end < lp->w_start)
			{
				new_line = TRUE;
				add_width_refresh_extent(frame, lp,
					erase_xmin, erase_xmax, REFRESH_ERASE);
				lp--;
			}
			if (new_line)
			{
				new_line = FALSE;

				erase_xmin = wp0->x_offset + wp0->draw_left;
				erase_xmax = wp0->x_offset + wp0->draw_width;
			}
			else
			{
				erase_xmin = __min(erase_xmin, wp0->x_offset + wp0->draw_left);
				erase_xmax = __max(erase_xmax, wp0->x_offset + wp0->draw_width);
			}

			paragraph->delete_word(w_end--);
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:67,代码来源:OLDFLOW.CPP

示例2: 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)
			{
//.........这里部分代码省略.........
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:101,代码来源:OLDFLOW.CPP

示例3: rebuild_lines


//.........这里部分代码省略.........

	if (wrange.w_start < 0)
	{
		wrange.w_start = 0;
	}
	if (wrange.w_end < 0)
	{
		wrange.w_end = word_count-1;
	}

	if (wrange.w_start > wrange.w_end || wrange.w_end >= word_count)
	{
	/* Error of a parameter nature. */

		paragraph->release();
		frame->release();

		return ERRORCODE_BadParameter;
	}

/*
// Find the line where the desired word starts.
// If the word hasn't been flowed yet, it may be "between" existing lines.
// If a word is not in a line, we'll shove it into the line just following it.
// This should always be possible, because the EOP word should always be
// flowed and in a line (and no word should come after it).
//
// We can do this really easily by just checking the last word in the line.
// If we are before that line, we have our line.
*/

	SHORT line_count = frame->number_of_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();
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:67,代码来源:OLDFLOW.CPP


注:本文中的FramePtr::get_line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。