mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ide: Drag and drop of package files
git-svn-id: svn://ultimatepp.org/upp/trunk@9262 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4a59c243f9
commit
85849e8da3
3 changed files with 22 additions and 6 deletions
|
|
@ -342,6 +342,12 @@ const T& GetInternal(PasteClip& d)
|
|||
return *(T *)GetInternalDropPtr__();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T *GetInternalPtr(PasteClip& d, const char *id = "")
|
||||
{
|
||||
return IsAvailableInternal<T>(d, id) ? (T *)GetInternalDropPtr__() : NULL;
|
||||
}
|
||||
|
||||
class Ctrl : public Pte<Ctrl> {
|
||||
public:
|
||||
enum PlacementConstants {
|
||||
|
|
|
|||
|
|
@ -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;%% ]]
|
||||
[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;%% ]]
|
||||
|
|
@ -1121,8 +1121,9 @@ void WorkspaceWork::MoveFile(int d)
|
|||
|
||||
void WorkspaceWork::DnDInsert(int line, PasteClip& d)
|
||||
{
|
||||
if(IsAvailableInternal<UppList>(d, "package-file") &&
|
||||
&GetInternal<UppList>(d) == &filelist && d.Accept()) {
|
||||
if(GetActivePackage() == METAPACKAGE)
|
||||
return;
|
||||
if(GetInternalPtr<UppList>(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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue