Example #1
0
Image IconDes::CursorImage(Point p, dword flags)
{
	if(IsHotSpot())
		return Image::Arrow();
	if(IsPasting())
		return HasCapture() ? IconDesImg::MoveMove()
		       : Rect(Current().pastepos, Current().paste_image.GetSize()).Contains(GetPos(p)) ? IconDesImg::MoveCursor()
		       : IconDesImg::MoveOk();
	return flags & K_SHIFT ? fill_cursor : cursor_image;
}
Example #2
0
void IconDes::MakePaste()
{
	if(!IsCurrent() || !IsPasting())
		return;
	Slot& c = Current();
	c.image = c.base_image;
	if(paste_opaque)
		UPP::Copy(c.image, c.pastepos, c.paste_image, c.paste_image.GetSize());
	else
		UPP::Over(c.image, c.pastepos, Premultiply(c.paste_image), c.paste_image.GetSize());
	MaskSelection();
}
Example #3
0
void IconDes::LeftUp(Point p, dword keyflags)
{
	if(!IsCurrent())
		return;
	if(IsPasting() && HasCapture())
		Refresh();
	else
	if(HasCapture() && selectrect)
		Move();
	else
		Current().base_image.Clear();
	SetBar();
	SyncShow();
}
Example #4
0
void IconDes::MouseMove(Point p, dword keyflags)
{
	if(!HasCapture() || !IsCurrent())
		return;
	p = GetPos(p);
	if(IsPasting()) {
		Current().pastepos = p - startpoint;
		MakePaste();
		return;
	}
	if(selectrect)
		EmptyRectTool(p, keyflags);
	else
	if(tool)
		(this->*tool)(p, keyflags);
}
Example #5
0
NAMESPACE_UPP

void IconDes::LeftDown(Point p, dword flags)
{
	SetFocus();
	if(!IsCurrent())
		return;
	SaveUndo();
	startpoint = GetPos(p);
	if(IsPasting()) {
		if(Rect(Current().pastepos, Current().paste_image.GetSize()).Contains(startpoint)) {
			startpoint -= Current().pastepos;
			SetCapture();
		}
		else
			FinishPaste();
		return;
	}
	SetCapture();
	Current().base_image = CurrentImage();
	if(flags & K_SHIFT) {
		ImageBuffer ib(CurrentImage());
		if(!doselection) {
			RGBA c = CurrentColor();
			c.r += 127;
			MaskFill(ib, c, 0);
		}
		FloodFill(ib, CurrentColor(), startpoint, ib.GetSize());
		SetCurrentImage(ib);
		if(!doselection)
			MaskSelection();
		return;
	}
	if(selectrect)
		EmptyRectTool(startpoint, flags);
	else
	if(tool)
		(this->*tool)(startpoint, flags);
}
Example #6
0
void IconDes::Move()
{
	if(!IsCurrent())
		return;
	Slot& c = Current();
	selectrect = false;
	if(IsPasting())
		FinishPaste();
	else {
		doselection = false;
		rgbactrl.Mask(false);
		rgbactrl.Hide();
		Rect r = SelectionRect();
		Image m = Copy(r);
		Delete();
		SetSelect(255);
		c.base_image = c.image;
		c.paste_image = m;
		c.pastepos = r.TopLeft();
		MakePaste();
	}
	SetBar();
}