示例#1
0
文件: GText.cpp 项目: FEI17N/Lgi
bool TextView::Paste()
{
	if (ClipText())
	{
		char *Text = ClipText();
		
		// Insert text into document
		OnInsertText(Text);

		// Calculate the end point of the inserted text
		int X, Y;
		CountLinesAndLen(Text, strlen(Text), X, Y);

		// Make the cursor point to the end of the inserted text
		if (Y > 0)
		{
			User.MoveY(Y);
			User.SetX(X);
		}
		else
		{
			User.MoveX(X);
		}
	}

	OnEndSelection();
	UpdateHiddenCheck();
	return TRUE;
}
示例#2
0
文件: GText.cpp 项目: FEI17N/Lgi
bool TextView::OnDeleteText(GCursor *c, int Len, bool Clip)
{
	bool Status = false;

	if (Clip)
	{
		ClipText((char*) *c, Len);
	}
	
	int OldLines = Doc.GetLines();
	Status = Doc.Delete(c, Len, (Clip) ? ClipText() : 0);
	if (Status)
	{
		if (Clip)
		{
			Dirty(TVF_DIRTY_ALL);
		}
		else
		{
			if (OldLines != Doc.GetLines())
			{
				Dirty(TVF_DIRTY_TO_EOP);
			}
			else
			{
				Dirty(TVF_DIRTY_TO_EOL);
			}
		}

		AfterDeleteText();
	}

	return Status;
}
示例#3
0
文件: GText.cpp 项目: FEI17N/Lgi
bool TextView::Copy()
{
	if (Flags & TVF_SELECTION)
	{
		GCursor S;
		int Len;

		if (Start < End)
		{
			S = Start;
			Len = End - Start;
		}
		else
		{
			S = End;
			Len = Start - End;
		}
		
		ClipText((char*) S, Len);
		return TRUE;
	}
	return FALSE;
}