CtrlCore: Cocoa fixed issue with internal drag and drop

git-svn-id: svn://ultimatepp.org/upp/trunk@12639 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-12-21 17:58:31 +00:00
parent c2cefa8b07
commit 77ded54ca8
2 changed files with 9 additions and 8 deletions

View file

@ -128,16 +128,18 @@ void Ctrl::RegisterCocoaDropFormats()
[nsview registerForDraggedTypes:[PasteboardTypes(drop_formats.GetKeys()) allObjects]];
}
void RegisterDropFormats(const char *formats)
void Ctrl::RegisterDropFormats(const char *formats)
{
int n = drop_formats.GetCount();
for(String fmt : Split(formats, ';'))
drop_formats.FindAdd(fmt);
for(Ctrl *q : Ctrl::GetTopCtrls())
q->RegisterCocoaDropFormats();
if(drop_formats.GetCount() != n)
for(Ctrl *q : Ctrl::GetTopCtrls())
q->RegisterCocoaDropFormats();
}
INITBLOCK {
RegisterDropFormats("text;png;image;rtf;files;url");
Ctrl::RegisterDropFormats("text;png;image;rtf;files;url");
}
void AppendClipboard(const char *format, const Value& value, String (*render)(const Value& data))
@ -419,8 +421,10 @@ int Ctrl::DoDragAndDrop(const char *fmts, const Image& sample, dword actions,
ClearClipboard(true);
ClipboardOwner(true)->source = this;
for(int i = 0; i < data.GetCount(); i++)
for(int i = 0; i < data.GetCount(); i++) {
RegisterDropFormats(data.GetKey(i));
AppendClipboard(true, data.GetKey(i), data[i].data, data[i].render);
}
for(String fmt : Split(fmts, ';')) // GetDropData formats
AppendClipboard(true, fmt, String(), NULL);

View file

@ -106,9 +106,7 @@ bool Gdb::Result(String& result, const String& s)
String Gdb::Cmd(const char *command, bool start)
{
if(!dbg || !dbg->IsRunning() || IdeIsDebugLock()) return Null;
#ifdef _DEBUG
TimeStop ts;
#endif
Lock();
if(command) {
LLOG("========= Cmd: " << command);
@ -125,7 +123,6 @@ String Gdb::Cmd(const char *command, bool start)
LLOG("Running: " << dbg->IsRunning());
break;
}
if(s.GetCount()) DDUMP(s);
if(!s.IsEmpty() && Result(result, s)) {
LLOG(result);
PutVerbose(result);