示例#1
0
SDst
AMUnitList::AdjustOffsetForHeight(SDst h, bool is_top)
{
	if(GetFullViewHeight() > h)
	{
		const SDst item_h(GetItemHeight());

		if(YB_UNLIKELY(item_h == 0))
			return 0;
		vwList.RestrictSelected();
		if(is_top)
			return AdjustBottomForHeight(item_h, h);
		else
		{
			const auto d((h + uTopOffset) % item_h);

			if(d != 0)
			{
				const auto tmp(uTopOffset + item_h - d);

				uTopOffset = tmp % item_h;
				AdjustViewLengthForHeight(item_h, h);
			// XXX: Conversion to 'ptrdiff_t' might be implementation-defined.
				vwList.IncreaseHead(ptrdiff_t(tmp / item_h), GetTotal());
			}
			return d;
		}
	}
	return 0;
}
示例#2
0
Session::Session(const TextFile& tf)
{
	ystdex::ifile_iterator i(*tf.GetPtr());

	while(!tf.CheckEOF())
	{
		if(YB_UNLIKELY(is_undereferenceable(i)))
			throw LoggedEvent("Bad Source!", Critical);
		llex.ParseByte(*i);
		++i;
	}
}