| 1491 | } |
| 1492 | |
| 1493 | void PartStack::PaneDragStart(PartPane::Pointer pane, QPoint& initialLocation, |
| 1494 | bool keyboard) |
| 1495 | { |
| 1496 | if (pane == 0) |
| 1497 | { |
| 1498 | if (this->CanMoveFolder()) |
| 1499 | { |
| 1500 | if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED) |
| 1501 | { |
| 1502 | // Calculate where the initial location was BEFORE the 'restore'...as a percentage |
| 1503 | QRect bounds = Geometry::ToDisplay(this->GetParent(), |
| 1504 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())); |
| 1505 | float xpct = (initialLocation.x() - bounds.x()) / (float)(bounds.width()); |
| 1506 | float ypct = (initialLocation.y() - bounds.y()) / (float)(bounds.height()); |
| 1507 | |
| 1508 | // Only restore if we're dragging views/view stacks |
| 1509 | if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR) |
| 1510 | this->SetState(IStackPresentationSite::STATE_RESTORED); |
| 1511 | |
| 1512 | // Now, adjust the initial location to be within the bounds of the restored rect |
| 1513 | bounds = Geometry::ToDisplay(this->GetParent(), |
| 1514 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())); |
| 1515 | initialLocation.setX((int) (bounds.x() + (xpct * bounds.width()))); |
| 1516 | initialLocation.setY((int) (bounds.y() + (ypct * bounds.height()))); |
| 1517 | } |
| 1518 | |
| 1519 | DragUtil::PerformDrag(Object::Pointer(this), Geometry::ToDisplay(this->GetParent(), |
| 1520 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())), |
| 1521 | initialLocation, !keyboard); |
| 1522 | } |
| 1523 | } |
| 1524 | else |
| 1525 | { |
| 1526 | if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED) |
| 1527 | { |
| 1528 | // Calculate where the initial location was BEFORE the 'restore'...as a percentage |
| 1529 | QRect bounds = Geometry::ToDisplay(this->GetParent(), |
| 1530 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())); |
| 1531 | float xpct = (initialLocation.x() - bounds.x()) / (float)(bounds.width()); |
| 1532 | float ypct = (initialLocation.y() - bounds.y()) / (float)(bounds.height()); |
| 1533 | |
| 1534 | // Only restore if we're dragging views/view stacks |
| 1535 | if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR) |
| 1536 | this->SetState(IStackPresentationSite::STATE_RESTORED); |
| 1537 | |
| 1538 | // Now, adjust the initial location to be within the bounds of the restored rect |
| 1539 | // See bug 100908 |
| 1540 | bounds = Geometry::ToDisplay(this->GetParent(), |
| 1541 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())); |
| 1542 | initialLocation.setX((int) (bounds.x() + (xpct * bounds.width()))); |
| 1543 | initialLocation.setY((int) (bounds.y() + (ypct * bounds.height()))); |
| 1544 | } |
| 1545 | |
| 1546 | DragUtil::PerformDrag(pane, Geometry::ToDisplay(this->GetParent(), |
| 1547 | Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())), |
| 1548 | initialLocation, !keyboard); |
| 1549 | } |
| 1550 | } |
no test coverage detected