Exemple #1
0
bool TextInStream::GetLine(char *s, int size) {
	if (size <= 0) return true;
	if (!FillBuffer()) return false;
	if (size == 1) { *s=0; return true; }
	size--;
		
	while (true) {
		if (pos >= count && !FillBuffer()) break;
		char *b = buffer.ptr() + pos;
		char *e = buffer.ptr() + count;
		
		for (; b < e; b++) if (*b =='\n') break;
		
		if (size > 0) 
		{
			int n = b - (buffer.ptr() + pos);
			if (n > size) n = size;
			memcpy(s, buffer.ptr() + pos, n);
			size -= n;
			s += n;
		}
			
		pos = b - buffer.ptr();
			
		if (b < e) {
			pos++;
			break;
		}
	}
	*s = 0;
	
	return true;
}
Exemple #2
0
void TBToolTip::Paint(wal::GC &gc, const crect &paintRect)
{
	gc.SetFillColor(UiGetColor(uiBackground, 0,0, 0xFFFFFF)/*GetColor(IC_BG)*/); //0x80FFFF);
	crect r = ClientRect();
	gc.FillRect(r);
	gc.SetTextColor(UiGetColor(uiColor, 0,0, 0)/*GetColor(IC_TEXT)*/);
	//gc.TextOutF(0,0,text.ptr());
	 DrawStaticText(gc, 2, 1, text.ptr(), GetFont(), false);
}
Exemple #3
0
bool SysOptDialog::Command(int id, int subId, Win *win, void *data)
{
	if (id == 1000) {
		CfgLangDialog dlg((NCDialogParent*)Parent(), curLangId.ptr(), &list);
		if (dlg.DoModal() == CMD_OK)
		{
			SetCurLang(dlg.GetId());
		}
		return true;
	}
	return NCVertDialog::Command(id, subId, win, data);
}
Exemple #4
0
void TextOutStream::Put(const char *s, int size)
{
	while (size > 0) 
	{
		if (pos >= bufSize) Flush();
		int n = bufSize - pos;
		if (n > size) n = size;
		memcpy(buffer.ptr()+pos, s, n);
		pos += n;
		size-=n;
		s+=n;
	}
}
Exemple #5
0
	void Flush(){ 	if (pos>0) { Write(buffer.ptr(), pos); pos = 0; } }
Exemple #6
0
	bool FillBuffer(){ if (pos < count) return true; if ( count <= 0) return false; count = Read(buffer.ptr(), bufSize); pos = 0; return count>0; }