Esempio n. 1
0
ushort Q3CString::toUShort(bool *ok) const
{
    ulong v = toULong(ok);
    if (ok && *ok && (v > 65535))
        *ok = false;
    return (ushort)v;
}
//-----------------------------------------------------------------------------
Tes4SubRecordXCLCCELL::Tes4SubRecordXCLCCELL(unsigned char* pBuffer)
	:	TesRecordSub(TesFileType::TES4),
		_flags(0)
{
	if (pBuffer != nullptr) {
		toString4(_name,  pBuffer);
		toUShort4(_size,  &pBuffer[4]);
		toLong   (_x,     &pBuffer[6]);
		toLong   (_y,     &pBuffer[10]);
		if (_size > 8) {
			toULong(_flags, &pBuffer[14]);
		}
	}
}
Esempio n. 3
0
unsigned long UString::toULong(bool *ok) const
{
  return toULong(ok, true);
}
Esempio n. 4
0
void CListWidget::update(int c)
{
	if(_visible)
	{
		uint tw = _size.width();
		uint th = _size.height();

		if(focused())
		{		
#ifdef __PDCURSES__
			// Mouse wheel scrolling
			if(c == KEY_MOUSE && _count > th)
			{
				if(Mouse_status.changes == MOUSE_WHEEL_DOWN)
				{
					_scroll += 4;
					_changed = true;
				}
				else if(Mouse_status.changes == MOUSE_WHEEL_UP && _scroll >= 4)
				{
					_scroll -= 4;
					_changed = true;
				}
			}
#endif
		}

		if((_listenKeys || focused()) && _count > th)
		{
			if(c == KEY_NPAGE)	// PAGE DOWN
			{
				_scroll += 4;
				_changed = true;
			}
			else if(c == KEY_PPAGE && _scroll >= 4)	// PAGE UP
			{
				_scroll -= 4;
				_changed = true;
			}
		}

		if(_changed)
		{
			move_panel(_panel, _pos.y(), _pos.x());
			top_panel(_panel);
			wclear(_window);

			if((_count < th && _scroll < _count) || (_count > th && _scroll > _count)) _scroll = _count;
			if(_count > th && _scroll < th) _scroll = th;

			uint b = 0, n = 0;

			for(uint i = 0; i < _items.size() && i < _scroll + b; ++i)
			{
				if(_items[i]->nocrlf()) b++;

				if(!_items[i]->nocrlf())
					n = 0;

				const string &message = _items[i]->text();

				for(uint j = 0; j < _leftMargin; ++j)
					waddch(_window, ' ');

				attr_t a = attribute(_items[i]->backgroundColor(), _items[i]->foregroundColor(), _items[i]->bold());
				wattr_on(_window, a, 0);

				n++;

				for(uint j = 0; j < message.size(); ++j, n++)
				{
					if(n >= tw - _leftMargin - _rightMargin)
					{
						n = 0;
						wattr_off(_window, a, 0);
						waddch(_window, '\n');
						for(uint j = 0; j < _leftMargin; ++j)
							waddch(_window, ' ');
						wattr_on(_window, a, 0);
					}

					waddch(_window, toULong(message[j]));
				}

				wattr_off(_window, a, 0);

				if(i < _scroll + b - 1 && i != _items.size() - 1 && !_items[i]->nocrlf())
					waddch(_window, '\n');
			}

			_changed = false;
		}
	}
}
Esempio n. 5
0
uint Q3CString::toUInt(bool *ok) const
{
    return (uint)toULong(ok);
}
Esempio n. 6
0
ulong CParameterProperties::toULongWithClean(const QString &str) {

	QString sTmp = str.right(str.length() - 1); sTmp = sTmp.left(sTmp.indexOf(".."));

	return toULong(sTmp);
}