|
|
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » Please bring back drag'n'drop copy
|
|
|
|
|
|
|
|
|
Re: Please bring back drag'n'drop copy [message #21265 is a reply to message #21257] |
Mon, 11 May 2009 11:59 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
I am sorry, I have to ask again:)
Without Ctrl, result is 100% predictable and it is move.
With Ctrl, result is random.
(I just cannot believe that...
Anyway, some DUMPs:
void UDropTarget::DnD(POINTL pl, bool drop, DWORD *effect, DWORD keys)
{
dword e = *effect;
LOG("DnD " << e == DROPEFFECT_COPY);
*effect = DROPEFFECT_NONE;
if(!ctrl)
return;
PasteClip d;
d.dt = this;
d.paste = drop;
d.accepted = false;
d.allowed = 0;
d.action = 0;
if(e & DROPEFFECT_COPY) {
d.allowed = DND_COPY;
d.action = DND_COPY;
}
if(e & DROPEFFECT_MOVE) {
d.allowed |= DND_MOVE;
if(Ctrl::GetDragAndDropSource())
d.action = DND_MOVE;
}
if((keys & MK_CONTROL) && (d.allowed & DND_COPY))
d.action = DND_COPY;
if((keys & (MK_ALT|MK_SHIFT)) && (d.allowed & DND_MOVE))
d.action = DND_MOVE;
ctrl->DnD(Point(pl.x, pl.y), d);
DDUMP(d.action);
if(d.IsAccepted()) {
if(d.action == DND_MOVE)
*effect = DROPEFFECT_MOVE;
if(d.action == DND_COPY)
*effect = DROPEFFECT_COPY;
}
}
STDMETHODIMP UDropSource::GiveFeedback(DWORD dwEffect)
{
LOG("GiveFeedback " << (dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY);
Image m = IsNull(move) ? copy : move;
if((dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY) {
if(!IsNull(copy)) m = copy;
}
else
if((dwEffect & DROPEFFECT_MOVE) == DROPEFFECT_MOVE) {
if(!IsNull(move)) m = move;
}
else
m = no;
Ctrl::OverrideCursor(m);
Ctrl::SetMouseCursor(m);
return S_OK;
}
Try with Ctrl pushed....
Mirek
|
|
|
|
Re: Please bring back drag'n'drop copy [message #21268 is a reply to message #21266] |
Mon, 11 May 2009 12:57 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Mindtraveller wrote on Mon, 11 May 2009 06:41 | And again
> Without Ctrl, result is 100% predictable and it is move
YES!
>With Ctrl, result is random
Ctrl->drag = YES! (You`ve seen that on video, what a shame it doesn`t indicate pressed keys)
drag->Ctrl = WORKS 100%
So the problem is with initial period when Ctrl is ALREADY pressed before dragging start.
Your patch doesn`t compile (I patched Win32DnD.cpp):
> LOG("DnD " << e == DROPEFFECT_COPY);
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'Upp::Stream' (or there is
no acceptable conversion)
> STDMETHODIMP UDropSource::GiveFeedback(DWORD dwEffect)
error C2027: use of undefined type 'Upp::UDropSource'
> LOG("GiveFeedback " << (dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY);
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'Upp::Stream' (or there is
no acceptable conversion)
... (about 5 more errors, please try to compile it)
|
Ah, sorry, put parenthesis around == operators please...
void UDropTarget::DnD(POINTL pl, bool drop, DWORD *effect, DWORD keys)
{
dword e = *effect;
LOG("DnD " << (e == DROPEFFECT_COPY));
*effect = DROPEFFECT_NONE;
if(!ctrl)
return;
PasteClip d;
d.dt = this;
d.paste = drop;
d.accepted = false;
d.allowed = 0;
d.action = 0;
if(e & DROPEFFECT_COPY) {
d.allowed = DND_COPY;
d.action = DND_COPY;
}
if(e & DROPEFFECT_MOVE) {
d.allowed |= DND_MOVE;
if(Ctrl::GetDragAndDropSource())
d.action = DND_MOVE;
}
DDUMP(keys & MK_CONTROL);
if((keys & MK_CONTROL) && (d.allowed & DND_COPY))
d.action = DND_COPY;
if((keys & (MK_ALT|MK_SHIFT)) && (d.allowed & DND_MOVE))
d.action = DND_MOVE;
ctrl->DnD(Point(pl.x, pl.y), d);
DDUMP(d.action);
if(d.IsAccepted()) {
if(d.action == DND_MOVE)
*effect = DROPEFFECT_MOVE;
if(d.action == DND_COPY)
*effect = DROPEFFECT_COPY;
}
}
STDMETHODIMP UDropSource::GiveFeedback(DWORD dwEffect)
{
LOG("GiveFeedback " << ((dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY));
Image m = IsNull(move) ? copy : move;
if((dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY) {
if(!IsNull(copy)) m = copy;
}
else
if((dwEffect & DROPEFFECT_MOVE) == DROPEFFECT_MOVE) {
if(!IsNull(move)) m = move;
}
else
m = no;
Ctrl::OverrideCursor(m);
Ctrl::SetMouseCursor(m);
return S_OK;
}
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Wed May 08 06:58:47 CEST 2024
Total time taken to generate the page: 0.02618 seconds
|
|
|