'Drag And Drop' violates read-only state for source with DND_MOVE

git-svn-id: svn://ultimatepp.org/upp/trunk@5721 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-01-19 13:35:32 +00:00
parent b286733dd1
commit 062bc6fcfe
5 changed files with 26 additions and 16 deletions

View file

@ -4,10 +4,11 @@
NAMESPACE_UPP
#define Time XTime
#define Font XFont
#define Display XDisplay
#define Picture XPicture
#define Time XTime
#define Font XFont
#define Display XDisplay
#define Picture XPicture
#define CurrentTime XCurrentTime
#include <gdk/gdkx.h>
@ -15,6 +16,7 @@ NAMESPACE_UPP
#undef Time
#undef Font
#undef Display
#undef CurrentTime
XDisplay *Xdisplay()
{

View file

@ -516,7 +516,8 @@ void DocEdit::DragAndDrop(Point p, PasteClip& d)
WString txt = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
@ -525,7 +526,8 @@ void DocEdit::DragAndDrop(Point p, PasteClip& d)
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
@ -586,7 +588,7 @@ void DocEdit::LeftDrag(Point p, dword flags)
iw.Alpha().DrawRect(ssz, Black());
DrawTLText(iw.Alpha(), 0, 0, ssz.cx, sample, StdFont(), White());
NextUndo();
if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE) {
if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE && !IsReadOnly()) {
RemoveSelection();
Action();
}

View file

@ -679,7 +679,8 @@ void EditField::DragAndDrop(Point p, PasteClip& d)
WString txt = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
@ -688,7 +689,8 @@ void EditField::DragAndDrop(Point p, PasteClip& d)
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
@ -754,7 +756,7 @@ void EditField::LeftDrag(Point p, dword flags)
Append(data, sel);
bool oks = keep_selection;
keep_selection = true;
if(DoDragAndDrop(data, iw) == DND_MOVE) {
if(DoDragAndDrop(data, iw) == DND_MOVE && !IsReadOnly()) {
CancelSelection();
SaveUndo();
Remove(sell, selh - sell);

View file

@ -793,7 +793,8 @@ void LineEdit::DragAndDrop(Point p, PasteClip& d)
WString text = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
@ -802,7 +803,8 @@ void LineEdit::DragAndDrop(Point p, PasteClip& d)
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
@ -868,7 +870,7 @@ void LineEdit::LeftDrag(Point p, dword flags)
iw.Alpha().DrawRect(sz, Black());
DrawTLText(iw.Alpha(), 0, 0, 9999, sample, Courier(10), White());
NextUndo();
if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE) {
if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE && !IsReadOnly()) {
RemoveSelection();
Action();
}

View file

@ -103,7 +103,8 @@ void RichEdit::DragAndDrop(Point p, PasteClip& d)
int a = sb;
int c = dropcursor;
if(InSelection(c)) {
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
}
@ -111,7 +112,8 @@ void RichEdit::DragAndDrop(Point p, PasteClip& d)
if(GetSelection(sell, selh) && d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
RemoveSelection();
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
Move(c);
@ -244,7 +246,7 @@ void RichEdit::LeftDrag(Point p, dword flags)
sample.Paint(iw, 0, 0, 128);
NextUndo();
if(DoDragAndDrop(String().Cat() << "text/QTF;" RTFS ";" << ClipFmtsText(),
ColorMask(iw, White)) == DND_MOVE) {
ColorMask(iw, White)) == DND_MOVE && !IsReadOnly()) {
RemoveSelection();
Action();
}