#include <sglfills.h>
Inheritance diagram for GalleryFillsDragInfo:
Public Member Functions | |
GalleryFillsDragInfo () | |
Default constructor - do not call this constructor. | |
~GalleryFillsDragInfo () | |
Destructor - reclaim temporary bitmap memory. | |
GalleryFillsDragInfo (SGFillsItem *pSourceItem, SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo, BOOL IsAdjust=FALSE, INT32 XSize=0, INT32 YSize=0) | |
Constructor. | |
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 SGDisplayBitmap, 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 Fill is dropped onto the page. Use pDragTarget->GetDropInfo(), to details of the drop. | |
SGFillsItem * | GetDraggedFill () |
Protected Attributes | |
SGFillsItem * | SourceItem |
SGMouseInfo | MouseInfo |
SGMiscInfo | MiscInfo |
Definition at line 325 of file sglfills.h.
|
Default constructor - do not call this constructor.
Definition at line 1988 of file sglfills.cpp. 01989 { 01990 ERROR3("Default GalleryFillsDragInfo constructor called"); 01991 }
|
|
Destructor - reclaim temporary bitmap memory.
Definition at line 2004 of file sglfills.cpp. 02005 { 02006 if(LibraryGallery::TmpDraggingBitmap != NULL) 02007 { 02008 delete LibraryGallery::TmpDraggingBitmap; 02009 LibraryGallery::TmpDraggingBitmap = NULL; 02010 } 02011 }
|
|
Constructor.
Definition at line 2034 of file sglfills.cpp. 02037 : BitmapDragInformation(LibraryGallery::TmpDraggingBitmap, 02038 XSize, YSize, 0, 0, IsAdjust) 02039 { 02040 SourceItem = pSourceItem; // Copy the source item pointer 02041 02042 MouseInfo = *pMouseInfo; // Duplicate the structures (they may cease to exist 02043 MiscInfo = *pMiscInfo; // soon after the drag is started) 02044 }
|
|
Reimplemented from DragInformation. Definition at line 341 of file sglfills.h. 00341 { return TRUE; };
|
|
Set cursor over this target.
Reimplemented from BitmapDragInformation. Definition at line 2082 of file sglfills.cpp. 02083 { 02084 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 02085 { 02086 PageDropInfo PageDropInfo; 02087 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 02088 02089 // Find the object we are over (and which bit of it) 02090 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 02091 ObjectDragTarget TargetHit = PageDropInfo.TargetHit; 02092 /* 02093 // Applying fills doesn't work asynchronously, so if we don't have the file we won't let the user drop it on objects 02094 PathName fillPath; 02095 SourceItem->GetFileName(&fillPath); 02096 if (pObjectHit && _taccess(fillPath.GetPath(), 0) == -1) 02097 return _R(IDC_CANTDROP); 02098 */ 02099 // We can't apply a fill to a NodeBitmap 02100 if (pObjectHit && pObjectHit->IS_KIND_OF(NodeBitmap)) 02101 TargetHit = NO_TARGET; // Ignore NodeBitmap objects 02102 02103 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); 02104 BOOL IsInside = ClickMods.Constrain; 02105 02106 if (!IsInside && pObjectHit && pObjectHit->IsCompound()) 02107 { 02108 TargetHit = MANY_TARGET; 02109 } 02110 02111 UINT32 CanFill = IsInside ? _R(IDC_DROPINSIDEONFILL) : _R(IDC_CANDROPONFILL); 02112 02113 switch (TargetHit) 02114 { 02115 case FILL_TARGET: 02116 case LINE_TARGET: 02117 case STARTCOL_TARGET: 02118 case ENDCOL_TARGET: 02119 case ENDCOL2_TARGET: 02120 case ENDCOL3_TARGET: 02121 case MANY_TARGET: 02122 return CanFill; 02123 02124 case NO_TARGET: 02125 // fill gallery - drop = page fill, CTRL + drop = add bitmap 02126 return IsInside ? _R(IDC_CANFILLPAGE) : _R(IDC_CANDROPONPAGE); 02127 //return _R(IDC_CANDROPONPAGE); 02128 }; 02129 02130 return _R(IDC_CANDROPONPAGE); 02131 } 02132 02133 return _R(IDC_CANTDROP); 02134 }
|
|
Definition at line 344 of file sglfills.h. 00344 { return(SourceItem); }
|
|
provide status line text for this target
Reimplemented from BitmapDragInformation. Definition at line 2147 of file sglfills.cpp. 02148 { 02149 ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()"); 02150 02151 //if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL) 02152 // return FALSE; 02153 02154 String_256 DragString; 02155 String_256 ItemName; 02156 SourceItem->GetNameText(&ItemName); 02157 PageDropInfo PageDropInfo; 02158 NodeRenderableInk* pObjectHit = NULL; 02159 ObjectDragTarget TargetHit; 02160 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 02161 { 02162 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 02163 pObjectHit = PageDropInfo.pObjectHit; 02164 TargetHit = PageDropInfo.TargetHit; 02165 } 02166 02167 02168 PathName fillPath; 02169 SourceItem->GetFileName(&fillPath); 02170 02171 // "Dragging fill '#1%s'" 02172 DragString.MakeMsg(_R(IDS_FILLS_DRAGGING), (TCHAR *)ItemName); 02173 02174 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 02175 { 02176 DragString += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); //" : "; 02177 02178 String_256 ObjectDesc = _R(IDS_SGLFILLS_THIS_OBJECT); // " this object"; 02179 02180 if (pObjectHit) 02181 { 02182 ObjectDesc = pObjectHit->Describe(FALSE); 02183 } 02184 02185 if (pObjectHit && pObjectHit->IS_KIND_OF(NodeBitmap)) 02186 TargetHit = NO_TARGET; // Ignore NodeBitmap objects 02187 02188 ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); 02189 BOOL IsInside = ClickMods.Constrain; 02190 02191 if (!IsInside && pObjectHit && pObjectHit->IsCompound()) 02192 { 02193 TargetHit = MANY_TARGET; 02194 } 02195 02196 switch (TargetHit) 02197 { 02198 case FILL_TARGET: 02199 case LINE_TARGET: 02200 case STARTCOL_TARGET: 02201 case ENDCOL_TARGET: 02202 case ENDCOL2_TARGET: 02203 case ENDCOL3_TARGET: 02204 DragString += String_64(_R(IDS_SGLFILLS_DROP_TO_APPLY)); //"Drop to apply the fill to this "; 02205 DragString += ObjectDesc; 02206 if (IsInside) 02207 DragString += String_64(_R(IDS_SGLFILLS_ALONE)); // " alone"; 02208 break; 02209 case MANY_TARGET: 02210 DragString += String_64(_R(IDS_SGLFILLS_DROP_TO_APPLY)); //"Drop to apply the fill to this "; 02211 DragString += ObjectDesc; 02212 DragString += String_64(_R(IDS_SGLFILLS_DROP_INSIDE)); // "; Press 'Control' to drop 'Inside'"; 02213 break; 02214 02215 case NO_TARGET: 02216 { 02217 if (IsInside) 02218 { 02219 DragString += String_256(_R(IDS_DRAGBMP_DROP_SETPAGEBACKGROUND)); // "Drop to set the Bitmap fill of the page background"; 02220 } 02221 else 02222 { 02223 // + "Drop to Insert a new Bitmap object on the Page" 02224 String_64 DropToThis(_R(IDS_FILLS_INSERT_BITMAP_TO_PAGE)); 02225 DragString += DropToThis; 02226 } 02227 break; 02228 } 02229 } 02230 02231 *TheText = DragString; 02232 return TRUE; 02233 } 02234 02235 *TheText = DragString; 02236 02237 return TRUE; 02238 }
|
|
This is called if a drag was attempted but never started because it was a click all along. It calls back the SourceItem SGDisplayBitmap, to get it to handle the click.
Reimplemented from BitmapDragInformation. Definition at line 2065 of file sglfills.cpp. 02066 { 02067 if (SourceItem != NULL) 02068 SourceItem->DragWasReallyAClick(&MouseInfo, &MiscInfo); 02069 }
|
|
Called when a Fill is dropped onto the page. Use pDragTarget->GetDropInfo(), to details of the drop.
Reimplemented from DragInformation. Definition at line 2254 of file sglfills.cpp. 02255 { 02256 enum FillTypeEnum FillType; 02257 02258 PageDropInfo ThePageDropInfo; 02259 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&ThePageDropInfo); 02260 NodeRenderableInk* pObjectHit = ThePageDropInfo.pObjectHit; 02261 02262 PathName FileName; 02263 SGLibDisplayItem *FillItem = SourceItem; 02264 02265 if (!FillItem->GetFileName(&FileName)) 02266 return FALSE; 02267 02268 if (!FileName.IsValid(FileName.GetPath())) 02269 { 02270 ERROR3("LibFillsSGallery::ImportFills - Filename is invalid"); 02271 return FALSE; 02272 } 02273 02274 BOOL NeedToDownload; 02275 if (_taccess(FileName.GetPath(), 0) == -1) 02276 NeedToDownload = TRUE; 02277 else 02278 NeedToDownload = FALSE; 02279 02280 BOOL Constrain = KeyPress::IsConstrainPressed(); 02281 if (Constrain && !pObjectHit) 02282 FillType = SetBackground; 02283 else if (pObjectHit && !pObjectHit->IS_KIND_OF(NodeBitmap)) 02284 FillType = ApplyToObject; 02285 else 02286 FillType = AddToPage; 02287 02288 if (!NeedToDownload) 02289 // Don't need to download the fill 02290 { 02291 TRACEUSER( "Jonathan", _T("Fills: File in cache\n")); 02292 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpBitmapImport)); 02293 02294 if (pOpDesc != 0) 02295 { 02296 BitmapImportParam Param; 02297 02298 Param.File = &FileName; 02299 Param.Result = TRUE; 02300 Param.pTargetDoc = Document::GetSelected(); 02301 Param.FillType = FillType; 02302 Param.pSpread = ThePageDropInfo.pSpread; 02303 Param.DropPos = ThePageDropInfo.DropPos; 02304 Param.TagObjectValid = false; 02305 Param.pObject = pObjectHit; 02306 Param.pObjectValid = true; 02307 02308 // Do it... 02309 pOpDesc->Invoke((OpParam *) &Param); 02310 02311 if (!Param.Result) 02312 { 02313 ERROR3("Problem importing file from cache"); 02314 return FALSE; 02315 } 02316 } 02317 } 02318 else 02319 // Need to download the fill 02320 { 02321 TRACEUSER( "Jonathan", _T("Fills: File not in cache : downloading\n")); 02322 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAsynchBitmapImport)); 02323 02324 if (pOpDesc != 0) 02325 { 02326 AsynchBitmapImportParam* Param = new AsynchBitmapImportParam; 02327 02328 if (!Param) 02329 return FALSE; 02330 Library* pLibrary = SourceItem->GetParentLibrary(); 02331 String_256 strFileURL = FileName.GetPath(); 02332 pLibrary->LocalPath2URL(&strFileURL); 02333 Param->file = FileName; 02334 Param->pTargetDoc = Document::GetSelected(); 02335 Param->strURL = strFileURL; 02336 String_256 strDescription; 02337 SourceItem->GetNameText(&strDescription); 02338 Param->strDescription = _T("'"); 02339 Param->strDescription += strDescription; 02340 Param->strDescription += _T("'"); 02341 Param->type = TYPE_FILL; 02342 Param->FillType = FillType; 02343 Param->priority = AsynchDownload::PRIORITY_HIGH; 02344 Param->pSpread = ThePageDropInfo.pSpread; 02345 Param->DropPos = ThePageDropInfo.DropPos; 02346 Param->pObjectValid = false; 02347 if (FillType == ApplyToObject || FillType == ApplyToObjectAsTransp) 02348 { 02349 Param->TagObjectToFill = pObjectHit->GetTag(); 02350 Param->TagObjectValid = true; 02351 } 02352 02353 // Do it... 02354 pOpDesc->Invoke((OpParam *) Param); 02355 } 02356 } 02357 return TRUE; 02358 }
|
|
Definition at line 349 of file sglfills.h. |
|
Definition at line 348 of file sglfills.h. |
|
Definition at line 347 of file sglfills.h. |