Fix some more bugs in the locale preflet lists. Dragging from one list to the other should now always work, while drawing inside a list is not finished, working on it now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35383 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -100,6 +100,8 @@ class LanguageListView: public BOutlineListView
|
|||||||
if (message->FindPointer("list", (void**)&list) == B_OK) {
|
if (message->FindPointer("list", (void**)&list) == B_OK) {
|
||||||
// It comes from a list
|
// It comes from a list
|
||||||
if (list == this) {
|
if (list == this) {
|
||||||
|
// TODO : parent item should stay at top level and childs should not
|
||||||
|
// move under another parent.
|
||||||
// It comes from ourselves : move the item around in the list
|
// It comes from ourselves : move the item around in the list
|
||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
if (fDropIndex < 0 || fDropIndex > count)
|
if (fDropIndex < 0 || fDropIndex > count)
|
||||||
@@ -122,6 +124,16 @@ class LanguageListView: public BOutlineListView
|
|||||||
if (fDropIndex < 0 || fDropIndex > count)
|
if (fDropIndex < 0 || fDropIndex > count)
|
||||||
fDropIndex = count;
|
fDropIndex = count;
|
||||||
|
|
||||||
|
// ensure we always drop things at top-level and not
|
||||||
|
// in the middle of another outline
|
||||||
|
if (Superitem(FullListItemAt(fDropIndex))) {
|
||||||
|
// Item has a parent
|
||||||
|
fDropIndex = FullListIndexOf(Superitem(FullListItemAt(fDropIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Item is now a top level one - we must insert just below its last child
|
||||||
|
fDropIndex += CountItemsUnder(FullListItemAt(fDropIndex),false);
|
||||||
|
|
||||||
int32 index;
|
int32 index;
|
||||||
for (int32 i = 0; message->FindInt32("index", i, &index)
|
for (int32 i = 0; message->FindInt32("index", i, &index)
|
||||||
== B_OK; i++) {
|
== B_OK; i++) {
|
||||||
@@ -182,8 +194,8 @@ LanguageListView::MoveItemFrom(BOutlineListView* origin, int32 index,
|
|||||||
// Check that the node we are going to move is a top-level one.
|
// Check that the node we are going to move is a top-level one.
|
||||||
// If not, we want his parent instead
|
// If not, we want his parent instead
|
||||||
|
|
||||||
LanguageListItem* itemToMove = static_cast<LanguageListItem*>(origin->Superitem(
|
LanguageListItem* itemToMove = static_cast<LanguageListItem*>(
|
||||||
origin->FullListItemAt(index)));
|
origin->Superitem(origin->FullListItemAt(index)));
|
||||||
if (itemToMove == NULL) {
|
if (itemToMove == NULL) {
|
||||||
itemToMove = static_cast<LanguageListItem*>(
|
itemToMove = static_cast<LanguageListItem*>(
|
||||||
origin->FullListItemAt(index));
|
origin->FullListItemAt(index));
|
||||||
@@ -221,7 +233,6 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
msg.AddPointer("list",(void*)(this));
|
msg.AddPointer("list",(void*)(this));
|
||||||
int32 index;
|
int32 index;
|
||||||
for (int32 i = 0; (index = FullListCurrentSelection(i)) >= 0; i++) {
|
for (int32 i = 0; (index = FullListCurrentSelection(i)) >= 0; i++) {
|
||||||
// TODO : include all childs and parents as needed
|
|
||||||
msg.AddInt32("index", index);
|
msg.AddInt32("index", index);
|
||||||
}
|
}
|
||||||
// figure out drag rect
|
// figure out drag rect
|
||||||
|
|||||||
Reference in New Issue
Block a user