#include <sglcart.h>
Inheritance diagram for GalleryClipartDragInfo:
Public Member Functions | |
GalleryClipartDragInfo () | |
Default constructor - do not call this constructor. | |
GalleryClipartDragInfo (SGClipartItem *pSourceItem, SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo, BOOL IsAdjust=FALSE, INT32 XSize=0, INT32 YSize=0) | |
Constructor. | |
~GalleryClipartDragInfo () | |
Destructor - need to unlock thumbnail. | |
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 Clipart is dropped onto the page. Use pDragTarget->GetDropInfo(), to details of the drop. | |
virtual BOOL | OnMainFrameDrop (DragTarget *pDragTarget) |
Called when this DragInfo is dropped onto the MainFrame. We open the file into a new document... | |
SGClipartItem * | GetDraggedClipart () |
Public Attributes | |
SGClipartItem * | SourceItem |
Protected Attributes | |
SGMouseInfo | MouseInfo |
SGMiscInfo | MiscInfo |
Definition at line 411 of file sglcart.h.
|
Default constructor - do not call this constructor.
Definition at line 2881 of file sglcart.cpp. 02882 { 02883 ERROR3("Default GalleryClipartDragInfo constructor called"); 02884 }
|
|
Constructor.
Definition at line 2930 of file sglcart.cpp. 02933 : BitmapDragInformation(LibraryGallery::TmpDraggingBitmap, 02934 /*pSourceItem->GetDisplayedKernelBitmap(pMiscInfo, TRUE)*/ 02935 XSize, YSize, 0, 0, IsAdjust) 02936 { 02937 SourceItem = pSourceItem; // Copy the source item pointer 02938 MouseInfo = *pMouseInfo; // Duplicate the structures (they may cease to exist 02939 MiscInfo = *pMiscInfo; // soon after the drag is started) 02940 }
|
|
Destructor - need to unlock thumbnail.
Definition at line 2898 of file sglcart.cpp. 02899 { 02900 TRACEUSER( "Richard", _T("~GalleryClipartDragInfo called\n")); 02901 02902 if(LibraryGallery::TmpDraggingBitmap != NULL) 02903 { 02904 delete LibraryGallery::TmpDraggingBitmap; 02905 LibraryGallery::TmpDraggingBitmap = NULL; 02906 } 02907 }
|
|
Reimplemented from DragInformation. Definition at line 427 of file sglcart.h. 00427 { return TRUE; }
|
|
Set cursor over this target.
Reimplemented from BitmapDragInformation. Definition at line 2979 of file sglcart.cpp. 02980 { 02981 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 02982 { 02983 PageDropInfo PageDropInfo; 02984 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 02985 02986 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 02987 ObjectDragTarget TargetHit = PageDropInfo.TargetHit; 02988 02989 if (pObjectHit) 02990 TargetHit = NO_TARGET; 02991 02992 switch (TargetHit) 02993 { 02994 case NO_TARGET: 02995 return _R(IDC_CANDROPONPAGE); 02996 }; 02997 02998 return _R(IDC_CANDROPONPAGE); 02999 } 03000 03001 return _R(IDC_CANTDROP); 03002 }
|
|
Definition at line 432 of file sglcart.h. 00432 { return(SourceItem); }
|
|
provide status line text for this target
Reimplemented from BitmapDragInformation. Definition at line 3015 of file sglcart.cpp. 03016 { 03017 ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()"); 03018 03019 if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL) 03020 return FALSE; 03021 03022 String_256 DragString; 03023 String_256 ItemName; 03024 SourceItem->GetNameText(&ItemName); 03025 03026 // "Dragging clipart '#1%s'" 03027 DragString.MakeMsg(_R(IDS_CLIPART_DRAGGING), (TCHAR *)ItemName); 03028 03029 if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget)) 03030 { 03031 DragString += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); //" : "; 03032 03033 PageDropInfo PageDropInfo; 03034 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 03035 03036 NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; 03037 ObjectDragTarget TargetHit = PageDropInfo.TargetHit; 03038 03039 if (pObjectHit) 03040 TargetHit = NO_TARGET; // Ignore NodeBitmap objects 03041 03042 switch (TargetHit) 03043 { 03044 case NO_TARGET: 03045 { 03046 // + "Drop to Insert the clipart at this point on the Page"; 03047 String_64 DropToThis(_R(IDS_CLIPART_DROP)); 03048 DragString += DropToThis; 03049 break; 03050 } 03051 }; 03052 03053 *TheText = DragString; 03054 return TRUE; 03055 } 03056 03057 *TheText = DragString; 03058 return TRUE; 03059 }
|
|
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 2961 of file sglcart.cpp. 02962 { 02963 TRACEUSER( "Matt", _T("GalleryClipartDragInfo::OnClick called\n")); 02964 if (SourceItem != NULL) 02965 SourceItem->DragWasReallyAClick(&MouseInfo, &MiscInfo); 02966 }
|
|
Called when this DragInfo is dropped onto the MainFrame. We open the file into a new document...
Definition at line 3212 of file sglcart.cpp. 03213 { 03214 SGLibDisplayItem* ClipItem = (SGLibDisplayItem*) SourceItem; 03215 String_256 ItemText; 03216 03217 if (ClipItem->IsKindOf(CC_RUNTIME_CLASS(SGClipartItem))) 03218 { 03219 ClipItem->GetNameText(&ItemText); 03220 PathName FileName; 03221 03222 //if (Lib != NULL) 03223 BOOL ok = ClipItem->GetFileName(&FileName); 03224 03225 if(ok) 03226 { 03227 // Bodge for clipart CD - 'Cow' in LScape should point to "Moo.tif", not just "Moo" 03228 if(FileName.GetFileName(FALSE) == (String_256)"Moo") 03229 { 03230 INT32 Size = ClipItem->GetFileSize(NULL); 03231 if(Size == 1080904) 03232 FileName.SetType("TIF"); 03233 } 03234 03235 if(!FileName.IsValid(FileName.GetPath())) 03236 { 03237 ERROR3("LibClipartSGallery::ImportClipart - Filename is invalid"); 03238 return FALSE; 03239 } 03240 03241 // Check if file has a long filename, and use that if it does... 03242 String_256 FilePath((const TCHAR *)FileName.GetPath()); 03243 String_256 LongFileName; 03244 BOOL LongPath = FileUtil::GetLongFileName((LPTSTR)FilePath, (LPTSTR)LongFileName, 255); 03245 if(LongPath) 03246 { 03247 FilePath = FileName.GetLocation(TRUE); 03248 FilePath += LongFileName; 03249 } 03250 03251 // Check if the file really exists on the local drive 03252 Library* pLibrary = ClipItem->GetParentLibrary(); 03253 if (!pLibrary) 03254 { 03255 ERROR3("Illegal NULL pointer"); 03256 return FALSE; 03257 } 03258 BOOL bIsLocalFile; 03259 if (!pLibrary->IsWebLibrary()) 03260 bIsLocalFile = TRUE; 03261 else 03262 bIsLocalFile = (_access((TCHAR*) FilePath, 0) != -1); 03263 03264 if (bIsLocalFile) 03265 { 03266 CWinApp* pApp = AfxGetApp(); 03267 BaseFileDialog::SelectedFilter = 0; 03268 03269 // Open a document 03270 CCamDoc* pDoc = (CCamDoc*) pApp->OpenDocumentFile((TCHAR *)FilePath); 03271 03272 // And redraw the imported document 03273 if(pDoc) pDoc->GetKernelDoc()->ForceRedraw(); 03274 } 03275 else // do an asynch import 03276 { 03277 String_256 strFileURL = FilePath; 03278 pLibrary->LocalPath2URL(&strFileURL); 03279 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAsynchClipartImport)); 03280 if (pOpDesc != NULL) 03281 { 03282 AsynchClipartImportParam* Param = new AsynchClipartImportParam; 03283 ERROR2IF(!Param, FALSE, "Memory allocation error"); 03284 // Set up the parameters which we require to import the clipart 03285 Param->File.SetPathName((TCHAR *)FilePath); 03286 String_256 strDescription; 03287 ClipItem->GetNameText(&strDescription); 03288 Param->strDescription = _T("'"); 03289 Param->strDescription += strDescription; 03290 Param->strDescription += _T("'"); 03291 Param->strURL = strFileURL; 03292 Param->Import = FALSE; 03293 Param->bDropped = FALSE; 03294 // Invoke the operation 03295 pOpDesc->Invoke((OpParam*) Param); 03296 } 03297 } 03298 } 03299 return TRUE; 03300 } 03301 return FALSE; 03302 }
|
|
Called when Clipart is dropped onto the page. Use pDragTarget->GetDropInfo(), to details of the drop.
Reimplemented from DragInformation. Definition at line 3074 of file sglcart.cpp. 03075 { 03076 PageDropInfo PageDropInfo; 03077 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); 03078 03079 PathName FileName; 03080 SGLibDisplayItem *ClipItem = SourceItem; 03081 03082 BOOL ok = ClipItem->GetFileName(&FileName); 03083 03084 if(ok) 03085 { 03086 // Bodge for clipart CD - 'Cow' in LScape should point to "Moo.tif", not just "Moo" 03087 if(FileName.GetFileName(FALSE) == (String_256)"Moo") 03088 { 03089 INT32 Size = ClipItem->GetFileSize(NULL); 03090 if(Size == 1080904) 03091 FileName.SetType("TIF"); 03092 } 03093 03094 if(!FileName.IsValid(FileName.GetPath())) 03095 { 03096 ERROR3("LibClipartSGallery::ImportClipart - Filename is invalid"); 03097 return FALSE; 03098 } 03099 03100 // Check if file has a long filename, and use that if it does... 03101 String_256 FilePath((const TCHAR *)FileName.GetPath()); 03102 String_256 LongFileName; 03103 BOOL LongPath = FileUtil::GetLongFileName((LPTSTR)FilePath, (LPTSTR)LongFileName, 255); 03104 if(LongPath) 03105 { 03106 FilePath = FileName.GetLocation(TRUE); 03107 FilePath += LongFileName; 03108 } 03109 03110 #ifdef STANDALONE 03111 CWinApp* pApp = AfxGetApp(); 03112 BaseFileDialog::SelectedFilter = 0; 03113 03114 // Open a document 03115 CCamDoc* pDoc = (CCamDoc*) pApp->OpenDocumentFile((TCHAR *)FilePath); 03116 03117 // And redraw the imported document 03118 if(pDoc) pDoc->GetKernelDoc()->ForceRedraw(); 03119 #else 03120 // Invoke the clipart import operation so that we get Undo. 03121 03122 Library* pLibrary = ClipItem->GetParentLibrary(); 03123 if (!pLibrary) 03124 { 03125 ERROR3("Illegal NULL pointer"); 03126 return FALSE; 03127 } 03128 BOOL bIsLocalFile; 03129 if (!pLibrary->IsWebLibrary()) 03130 bIsLocalFile = TRUE; 03131 else 03132 bIsLocalFile = (_access((TCHAR*) FilePath, 0) != -1); 03133 03134 03135 03136 if (bIsLocalFile) // local file, do a normal import Op 03137 { 03138 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpClipartImport)); 03139 03140 if (pOpDesc != NULL) 03141 { 03142 ClipartImportParam Param; 03143 03144 // Set up the parameters which we require to import the clipart 03145 PathName FullPathName((TCHAR *)FilePath); 03146 Param.File = &FullPathName; 03147 03148 Param.Import = TRUE; 03149 if(PageDropInfo.pDoc == NULL) 03150 Param.Import = FALSE; 03151 03152 Param.Result = TRUE; 03153 Param.DropInfo = &PageDropInfo; // for positioning and scaling 03154 03155 // Go for it! 03156 pOpDesc->Invoke((OpParam *) &Param); 03157 03158 ok = Param.Result; 03159 03160 if(!ok) 03161 { 03162 ERROR3("LibClipartSGallery::ImportClipart - Problem importing file"); 03163 return FALSE; 03164 } 03165 } 03166 } 03167 else // try an asynch import 03168 { 03169 String_256 strFileURL = FilePath; 03170 pLibrary->LocalPath2URL(&strFileURL); 03171 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpAsynchClipartImport)); 03172 if (pOpDesc != NULL) 03173 { 03174 AsynchClipartImportParam* Param = new AsynchClipartImportParam; 03175 ERROR2IF(!Param, FALSE, "Memory allocation error"); 03176 // Set up the parameters which we require to import the clipart 03177 Param->File.SetPathName((TCHAR *)FilePath); 03178 Param->strURL = strFileURL; 03179 String_256 strDescription; 03180 ClipItem->GetNameText(&strDescription); 03181 Param->strDescription = _T("'"); 03182 Param->strDescription += strDescription; 03183 Param->strDescription += _T("'"); 03184 Param->bDropped = TRUE; 03185 Param->Import = (PageDropInfo.pDoc == NULL) ? FALSE : TRUE; 03186 ((ViewDragTarget*)pDragTarget)->GetDropInfo(&Param->DropInfo); 03187 pOpDesc->Invoke((OpParam *) Param); 03188 } 03189 } 03190 #endif 03191 } 03192 03193 return TRUE; 03194 }
|
|
|
|
|
|
|