diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index 32ceafb36..29753335c 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -342,6 +342,12 @@ const T& GetInternal(PasteClip& d) return *(T *)GetInternalDropPtr__(); } +template +const T *GetInternalPtr(PasteClip& d, const char *id = "") +{ + return IsAvailableInternal(d, id) ? (T *)GetInternalDropPtr__() : NULL; +} + class Ctrl : public Pte { public: enum PlacementConstants { diff --git a/uppsrc/CtrlCore/src.tpp/PasteClipUtil$en-us.tpp b/uppsrc/CtrlCore/src.tpp/PasteClipUtil$en-us.tpp index bb9082ff5..e61c81705 100644 --- a/uppsrc/CtrlCore/src.tpp/PasteClipUtil$en-us.tpp +++ b/uppsrc/CtrlCore/src.tpp/PasteClipUtil$en-us.tpp @@ -121,17 +121,24 @@ to objects. [%-*@3 x] must exists as long as clip is available.&] [s5;:IsAvailableInternal`(PasteClip`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) c lass]_[*@4 T]>_[@(0.0.255) bool]_[* IsAvailableInternal]([_^PasteClip^ PasteClip][@(0.0.255) `& ]_[*@3 d], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id]_`=_`"`")&] -[s2;%% Returns true if there is internal clip in [%-*@3 d].&] +[s2;%% Returns true if there is internal clip of required type and +[%-*@3 id ]in [%-*@3 d].&] [s3;%% &] [s4; &] [s5;:AcceptInternal`(PasteClip`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) clas s]_[*@4 T]>_[@(0.0.255) bool]_[* AcceptInternal]([_^PasteClip^ PasteClip][@(0.0.255) `&]_[*@3 d ], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id]_`=_`"`")&] -[s2;%% Accepts internal clip.&] +[s2;%% Accepts internal clip of required type and [%-*@3 id].&] [s3;%% &] [s4; &] [s5;:GetInternal`(PasteClip`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) c onst]_[*@4 T][@(0.0.255) `&]_[* GetInternal]([_^PasteClip^ PasteClip][@(0.0.255) `&]_[*@3 d]) &] -[s2;%% Returns a reference to variable of internal clip.&] -[s0;%% ]] \ No newline at end of file +[s2;%% Returns a reference to internal clip.&] +[s4; &] +[s5;:Upp`:`:GetInternalPtr`(Upp`:`:PasteClip`&`,const char`*`): [@(0.0.255) template]_< +[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) const]_[*@4 T]_`*[* GetInternalPtr]([_^Upp`:`:PasteClip^ P +asteClip][@(0.0.255) `&]_[*@3 d], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id]_`=_`"`")&] +[s2;%% If internal clip of required type and [%-*@3 id ]is available, +returns a pointer to it, NULL otherwise.&] +[s3;%% ]] \ No newline at end of file diff --git a/uppsrc/ide/UppWspc.cpp b/uppsrc/ide/UppWspc.cpp index d8cdfb33a..1c7793ee2 100644 --- a/uppsrc/ide/UppWspc.cpp +++ b/uppsrc/ide/UppWspc.cpp @@ -1121,8 +1121,9 @@ void WorkspaceWork::MoveFile(int d) void WorkspaceWork::DnDInsert(int line, PasteClip& d) { - if(IsAvailableInternal(d, "package-file") && - &GetInternal(d) == &filelist && d.Accept()) { + if(GetActivePackage() == METAPACKAGE) + return; + if(GetInternalPtr(d, "package-file") == &filelist && d.Accept()) { int fi = filelist.GetCursor(); int s = filelist.GetSbPos(); if(fi < 0 || fi > fileindex.GetCount() || line < 0 || line > fileindex.GetCount()) @@ -1134,6 +1135,8 @@ void WorkspaceWork::DnDInsert(int line, PasteClip& d) ShowFile(a); ShowFile(b); actual.file.Move(a, b); + if(b >= a) + b--; ShowFile(a); ShowFile(b); SavePackage();