#include <sgldrag.h>
Inheritance diagram for GalleryLineDragInfo:
Public Member Functions | |
GalleryLineDragInfo () | |
Default constructor - do not call this constructor. | |
GalleryLineDragInfo (LineAttrItem *pSourceItem, SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo, BOOL IsAdjust=FALSE) | |
Constructor. | |
~GalleryLineDragInfo () | |
Destructor. Deletes the dragged bitmap. | |
virtual void | OnClick (INT32 Flags, POINT Point) |
This is called if a drag was attempted but never started because it was a click all along. It calls back the SourceItem SGDisplayLine, to get it to handle the click. | |
virtual UINT32 | GetCursorID (DragTarget *pDragTarget) |
Set cursor over this target. | |
virtual BOOL | GetStatusLineText (String_256 *TheText, DragTarget *pDragTarget) |
provide status line text for this target | |
virtual BOOL | CanDropOnPage () |
virtual BOOL | OnPageDrop (ViewDragTarget *) |
Called when a Line Attr is dropped onto the page. | |
virtual INT32 | GetDragTransparency () |
Specifies how transparent a drag should be. A value of 0, will cause a normal solid blit. Any other value (between 0 and 100), will cause a masked blit. | |
virtual KernelBitmap * | GetSolidDragMask () |
Makes a 1bpp KernelBitmap mask for the solid drag. | |
LineAttrItem * | GetDraggedLineAttr () |
Protected Member Functions | |
BOOL | DropStartOrEndArrow (Path *, DocCoord, BOOL *) |
Checks to see whether the arrow was dropped nearer to the start or end of a path. | |
NodeAttribute * | MakeStartOrEndArrow (NodeAttribute *, BOOL) |
Makes a Start or End arrow depending on where the arrow was dropped. | |
Protected Attributes | |
LineAttrItem * | SourceItem |
SGMouseInfo | MouseInfo |
SGMiscInfo | MiscInfo |
NodeAttribute * | pAttr |
Definition at line 121 of file sgldrag.h.
|
Default constructor - do not call this constructor.
Definition at line 224 of file sgldrag.cpp. 00225 { 00226 ERROR3("Default GalleryLineDragInfo constructor called"); 00227 }
|
|
Constructor.
Definition at line 249 of file sgldrag.cpp. 00252 : BitmapDragInformation(NULL, 100,50,0,0, 00253 IsAdjust) 00254 { 00255 SourceItem = pSourceItem; // Copy the source item pointer 00256 00257 pAttr = SourceItem->CreateNewAttribute(IsAdjust); 00258 00259 MouseInfo = *pMouseInfo; // Duplicate the structures (they may cease to exist 00260 MiscInfo = *pMiscInfo; // soon after the drag is started) 00261 }
|
|
Destructor. Deletes the dragged bitmap.
Definition at line 274 of file sgldrag.cpp. 00275 { 00276 if (TheBitmap != NULL) 00277 { 00278 delete TheBitmap; 00279 TheBitmap = NULL; 00280 } 00281 00282 if (pAttr != NULL) 00283 delete pAttr; 00284 }
|
|
Reimplemented from DragInformation. Definition at line 138 of file sgldrag.h. 00138 { return TRUE; }
|
|
Checks to see whether the arrow was dropped nearer to the start or end of a path.
Definition at line 609 of file sgldrag.cpp. 00611 { 00612 double NearestDist = -1; 00613 BOOL GotNearest = FALSE; 00614 BOOL NearestIsStart = FALSE; 00615 00616 DocCoord* Coords = pPathHit->GetCoordArray(); 00617 PathVerb* Verbs = pPathHit->GetVerbArray(); 00618 INT32 NumCoords = pPathHit->GetNumCoords(); 00619 00620 DocCoord ArrowCentre; 00621 DocCoord ArrowDirection; 00622 00623 INT32 PathIndex = 0; 00624 00625 // Find the first position of an ArrowHead 00626 BOOL GotPos = ArrowRec::GetFirstArrowPos(TRUE, 00627 Coords, Verbs, NumCoords, 00628 &PathIndex, &ArrowCentre, &ArrowDirection); 00629 while (GotPos) 00630 { 00631 double Dist = ArrowCentre.Distance(DropPos); 00632 00633 if (NearestDist == -1 || Dist < NearestDist) 00634 { 00635 NearestDist = Dist; 00636 GotNearest = TRUE; 00637 NearestIsStart = TRUE; 00638 } 00639 00640 // Find the next Arrow position (if there are any more subpaths) 00641 GotPos = ArrowRec::GetNextArrowPos(TRUE, 00642 Coords, Verbs, NumCoords, 00643 &PathIndex, &ArrowCentre, &ArrowDirection); 00644 } 00645 00646 // Now test all the end positions 00647 PathIndex = 0; 00648 00649 // Find the first position of an ArrowHead 00650 GotPos = ArrowRec::GetFirstArrowPos(FALSE, 00651 Coords, Verbs, NumCoords, 00652 &PathIndex, &ArrowCentre, &ArrowDirection); 00653 while (GotPos) 00654 { 00655 double Dist = ArrowCentre.Distance(DropPos); 00656 00657 if (NearestDist == -1 || Dist < NearestDist) 00658 { 00659 NearestDist = Dist; 00660 GotNearest = TRUE; 00661 NearestIsStart = FALSE; 00662 } 00663 00664 // Find the next Arrow position (if there are any more subpaths) 00665 GotPos = ArrowRec::GetNextArrowPos(FALSE, 00666 Coords, Verbs, NumCoords, 00667 &PathIndex, &ArrowCentre, &ArrowDirection); 00668 } 00669 00670 if (GotNearest) 00671 *IsStart = NearestIsStart; 00672 00673 return GotNearest; 00674 }
|
|
Set cursor over this target.
Reimplemented from BitmapDragInformation. Definition at line 320 of file sgldrag.cpp. 00321 { 00322 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 00323 { 00324 PageDropInfo PageDropInfo; 00325 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 00326 00327 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 00328 ObjectDragTarget TargetHit = PageDropInfo.TargetHit; 00329 00330 if (IS_A(pAttr, AttrStartArrow) || IS_A(pAttr, AttrEndArrow)) 00331 { 00332 if (pObjectHit && pObjectHit->IS_KIND_OF(NodePath)) 00333 { 00334 Path* pPath = &((NodePath*)pObjectHit)->InkPath; 00335 BOOL IsStart; 00336 if (DropStartOrEndArrow(pPath, PageDropInfo.DropPos, &IsStart)) 00337 { 00338 TargetHit = IsStart ? STARTCOL_TARGET : ENDCOL_TARGET; 00339 } 00340 } 00341 } 00342 00343 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); 00344 BOOL IsInside = ClickMods.Constrain; 00345 00346 if (!IsInside && pObjectHit && pObjectHit->IsCompound()) 00347 { 00348 TargetHit = MANY_TARGET; 00349 } 00350 00351 switch (TargetHit) 00352 { 00353 case FILL_TARGET: 00354 return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE); 00355 case LINE_TARGET: 00356 return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE); 00357 case STARTCOL_TARGET: 00358 return IsInside ? _R(IDC_DROPINSIDEONFILLSTART) : _R(IDC_CANDROPONFILLSTART); 00359 case ENDCOL_TARGET: 00360 return IsInside ? _R(IDC_DROPINSIDEONFILLEND) : _R(IDC_CANDROPONFILLEND); 00361 case MANY_TARGET: 00362 return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE); 00363 00364 case NO_TARGET: 00365 return _R(IDC_CANDROPONPAGE); 00366 default: 00367 break; 00368 }; 00369 00370 return _R(IDC_CANDROPONPAGE); 00371 } 00372 00373 return _R(IDC_CANTDROP); 00374 }
|
|
Definition at line 144 of file sgldrag.h. 00144 { return(SourceItem); }
|
|
Specifies how transparent a drag should be. A value of 0, will cause a normal solid blit. Any other value (between 0 and 100), will cause a masked blit.
Reimplemented from BitmapDragInformation. Definition at line 527 of file sgldrag.cpp. 00528 { 00529 // if (IS_A(pAttr, AttrStartArrow) || IS_A(pAttr, AttrEndArrow)) 00530 // return 50; 00531 00532 return 50; 00533 }
|
|
Makes a 1bpp KernelBitmap mask for the solid drag.
Reimplemented from BitmapDragInformation. Definition at line 547 of file sgldrag.cpp. 00548 { 00549 // Note we abuse this call (like our base class abuses this call) to create the bitmap 00550 // itself. We don't use DragMask itself anymore (i.e. it stays NULL) 00551 if (!DragMask && !TheBitmap) 00552 { 00553 DocView *View = DocView::GetCurrent(); 00554 if (View == NULL) 00555 { 00556 return NULL; 00557 } 00558 00559 Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0)); 00560 if (pSpread == NULL) 00561 { 00562 return NULL; 00563 } 00564 00565 // Find the size of the rendered item. 00566 DocRect ClipRegion(0,0, 750*100, 750*50); 00567 // ClipRegion.lo.x = ClipRegion.lo.y = 0; 00568 // SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y); 00569 Matrix ConvertMatrix; 00570 FIXED16 ViewScale = 1; 00571 00572 wxScreenDC DisplayDC; 00573 double dpi = (double) OSRenderRegion::GetFixedDCPPI(DisplayDC).GetWidth(); 00574 00575 GRenderBitmap* pMaskRegion = new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale, 00576 32, dpi); 00577 00578 pMaskRegion->SetDoCompression(TRUE); // misnamed call to indicate we want transparency 00579 pMaskRegion->AttachDevice(View, &DisplayDC, pSpread); 00580 00581 // Make a Mask Bitmap 00582 pMaskRegion->StartRender(); 00583 SourceItem->Render(pMaskRegion, ClipRegion, c_eLineAttrDragTextPos); 00584 pMaskRegion->StopRender(); 00585 00586 OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap(); 00587 TheBitmap = new KernelBitmap(pOilMaskBmp, TRUE); 00588 00589 delete pMaskRegion; 00590 } 00591 00592 return BitmapDragInformation::GetSolidDragMask(); 00593 }
|
|
provide status line text for this target
Reimplemented from BitmapDragInformation. Definition at line 387 of file sgldrag.cpp. 00388 { 00389 ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()"); 00390 00391 if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL) 00392 return FALSE; 00393 00394 String_256 DragString(_R(IDS_SGLDRAG_DRAG_LINE_ATTR)); // "Dragging line attribute" 00395 DragString += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); //" : "; 00396 00397 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 00398 { 00399 PageDropInfo PageDropInfo; 00400 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 00401 00402 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 00403 ObjectDragTarget TargetHit = PageDropInfo.TargetHit; 00404 00405 String_256 ObjectDesc = _R(IDS_SGLDRAG_THIS_OBJECT); // " this object"; 00406 00407 if (pObjectHit) 00408 { 00409 ObjectDesc = pObjectHit->Describe(FALSE); 00410 } 00411 00412 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); 00413 BOOL IsInside = ClickMods.Constrain; 00414 00415 if (!IsInside && pObjectHit && pObjectHit->IsCompound()) 00416 { 00417 TargetHit = MANY_TARGET; 00418 } 00419 00420 switch (TargetHit) 00421 { 00422 case FILL_TARGET: 00423 case LINE_TARGET: 00424 case STARTCOL_TARGET: 00425 case ENDCOL_TARGET: 00426 DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this "; 00427 DragString += ObjectDesc; 00428 if (IsInside) 00429 DragString += String_64(_R(IDS_SGLDRAG_SPACE_ALONE)); // " alone"; 00430 break; 00431 00432 case MANY_TARGET: 00433 DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this "; 00434 DragString += ObjectDesc; 00435 DragString += String_64(_R(IDS_SGLDRAG_CONTROL_DROP_INSIDE)); // "; Press 'Control' to drop 'Inside'"; 00436 break; 00437 00438 case NO_TARGET: 00439 DragString += String_64(_R(IDS_SGLDRAG_DROP_CURRENT_ATTRIBUTE)); // "Drop to set the Current Attribute"; 00440 break; 00441 default: 00442 break; 00443 }; 00444 00445 *TheText = DragString; 00446 return TRUE; 00447 } 00448 00449 return FALSE; 00450 }
|
|
Makes a Start or End arrow depending on where the arrow was dropped.
Definition at line 688 of file sgldrag.cpp. 00689 { 00690 ArrowRec Arrow; 00691 NodeAttribute* NewAttr; 00692 00693 if (IS_A(pArrowAttr, AttrStartArrow)) 00694 { 00695 Arrow = ((AttrStartArrow*)pArrowAttr)->Value.StartArrow; 00696 } 00697 else 00698 { 00699 Arrow = ((AttrEndArrow*)pArrowAttr)->Value.EndArrow; 00700 } 00701 00702 if (Start) 00703 { 00704 NewAttr = new AttrStartArrow(); 00705 ((AttrStartArrow*)NewAttr)->Value.StartArrow = Arrow; 00706 } 00707 else 00708 { 00709 NewAttr = new AttrEndArrow(); 00710 ((AttrEndArrow*)NewAttr)->Value.EndArrow = Arrow; 00711 } 00712 00713 delete pArrowAttr; 00714 return NewAttr; 00715 }
|
|
This is called if a drag was attempted but never started because it was a click all along. It calls back the SourceItem SGDisplayLine, to get it to handle the click.
Reimplemented from BitmapDragInformation. Definition at line 303 of file sgldrag.cpp. 00304 { 00305 if (SourceItem != NULL) 00306 SourceItem->DragWasReallyAClick(&MouseInfo, &MiscInfo); 00307 }
|
|
Called when a Line Attr is dropped onto the page.
Reimplemented from DragInformation. Definition at line 467 of file sgldrag.cpp. 00468 { 00469 PageDropInfo PageDropInfo; 00470 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 00471 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 00472 00473 NodeAttribute* Attrib = SourceItem->CreateNewAttribute(IsAnAdjustDrag()); 00474 00475 if (Attrib == NULL) 00476 return FALSE; 00477 00478 if (pObjectHit && (IS_A(Attrib, AttrStartArrow) || IS_A(Attrib, AttrEndArrow))) 00479 { 00480 if (!pObjectHit->IS_KIND_OF(NodePath)) 00481 { 00482 delete Attrib; 00483 return FALSE; 00484 } 00485 00486 Path* pPath = &((NodePath*)pObjectHit)->InkPath; 00487 BOOL IsStart; 00488 00489 if (!DropStartOrEndArrow(pPath, PageDropInfo.DropPos, &IsStart)) 00490 { 00491 delete Attrib; 00492 return FALSE; 00493 } 00494 00495 Attrib = MakeStartOrEndArrow(Attrib, IsStart); 00496 } 00497 00498 if (pObjectHit) 00499 { 00500 // Hit a Line Object, so apply attribute to it 00501 AttributeManager::ApplyAttribToNode(pObjectHit, Attrib); 00502 } 00503 else 00504 { 00505 // Didn't hit anything, so just set the current attribute 00506 AttributeManager::AttributeSelected(Attrib); 00507 } 00508 00509 return TRUE; 00510 }
|
|
|
|
|
|
|
|
|