GalleryClipartDragInfo Class Reference

A fill drag, which was started from the fill gallery. More...

#include <sglcart.h>

Inheritance diagram for GalleryClipartDragInfo:

BitmapDragInformation DragInformation CCObject SimpleCCObject List of all members.

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...
SGClipartItemGetDraggedClipart ()

Public Attributes

SGClipartItemSourceItem

Protected Attributes

SGMouseInfo MouseInfo
SGMiscInfo MiscInfo

Detailed Description

A fill drag, which was started from the fill gallery.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/4/95
See also:
BitmapDragInformation

Definition at line 411 of file sglcart.h.


Constructor & Destructor Documentation

GalleryClipartDragInfo::GalleryClipartDragInfo  ) 
 

Default constructor - do not call this constructor.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/95

Definition at line 2881 of file sglcart.cpp.

02882 {
02883     ERROR3("Default GalleryClipartDragInfo constructor called");    
02884 }

GalleryClipartDragInfo::GalleryClipartDragInfo SGClipartItem pSourceItem,
SGMouseInfo pMouseInfo,
SGMiscInfo pMiscInfo,
BOOL  IsAdjust = FALSE,
INT32  XSize = 0,
INT32  YSize = 0
 

Constructor.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/95
Parameters:
pSourceItem - The gallery item from which the drag originated [INPUTS] pMouseInfo - The mouse info which made the item start the drag pMiscInfo - The MiscInfo which accompanied the mouse event IsAdjust - TRUE if this is an adjust (line-Bitmap) drag XSize - Width in pixels of preview to drag YSize - Height in pixels of preview to drag

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 }

GalleryClipartDragInfo::~GalleryClipartDragInfo  ) 
 

Destructor - need to unlock thumbnail.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/4/95

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 }


Member Function Documentation

virtual BOOL GalleryClipartDragInfo::CanDropOnPage  )  [inline, virtual]
 

Reimplemented from DragInformation.

Definition at line 427 of file sglcart.h.

00427 { return TRUE; }

UINT32 GalleryClipartDragInfo::GetCursorID DragTarget pDragTarget  )  [virtual]
 

Set cursor over this target.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95

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 }

SGClipartItem* GalleryClipartDragInfo::GetDraggedClipart  )  [inline]
 

Definition at line 432 of file sglcart.h.

00432 { return(SourceItem); }

BOOL GalleryClipartDragInfo::GetStatusLineText String_256 TheText,
DragTarget pDragTarget
[virtual]
 

provide status line text for this target

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
Returns:
Whether String is valid

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 }

void GalleryClipartDragInfo::OnClick INT32  Flags,
POINT  Point
[virtual]
 

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.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

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 }

BOOL GalleryClipartDragInfo::OnMainFrameDrop DragTarget pDragTarget  )  [virtual]
 

Called when this DragInfo is dropped onto the MainFrame. We open the file into a new document...

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/95
Parameters:
pDragTarget,the Target that this drag finished over. [INPUTS]
Returns:
TRUE, if we handled the drop. FALSE, if we want to let the target handle it.

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 }

BOOL GalleryClipartDragInfo::OnPageDrop ViewDragTarget pDragTarget  )  [virtual]
 

Called when Clipart is dropped onto the page. Use pDragTarget->GetDropInfo(), to details of the drop.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/95
Parameters:
pDragTarget,the ViewDragTarget that we were dropped onto. [INPUTS]
Returns:
TRUE, if we handled 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 }


Member Data Documentation

SGMiscInfo GalleryClipartDragInfo::MiscInfo [protected]
 

Definition at line 438 of file sglcart.h.

SGMouseInfo GalleryClipartDragInfo::MouseInfo [protected]
 

Definition at line 437 of file sglcart.h.

SGClipartItem* GalleryClipartDragInfo::SourceItem
 

Definition at line 435 of file sglcart.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:54:41 2007 for Camelot by  doxygen 1.4.4